aboutsummaryrefslogtreecommitdiff
path: root/js/components
diff options
context:
space:
mode:
authorJose Antonio Marquez Russo2012-07-23 18:36:23 -0700
committerJose Antonio Marquez Russo2012-07-23 18:36:23 -0700
commit9c74db91b9f0c755eb8e8c36d5270b7db90c8ff7 (patch)
tree610434d27d3f75d5115628cb1d59422e9fb5a197 /js/components
parent5d35e4bb5d59c994a5ffb6064eec774aea76ba64 (diff)
parent48d9ed19573a07c68da305d14ca6ab3a04d31d64 (diff)
downloadninja-9c74db91b9f0c755eb8e8c36d5270b7db90c8ff7.tar.gz
Merge pull request #44 from ananyasen/Document
first cut to show code editor for design document
Diffstat (limited to 'js/components')
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.js38
1 files changed, 37 insertions, 1 deletions
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js
index 5623f825..803d2c3a 100755
--- a/js/components/layout/document-bar.reel/document-bar.js
+++ b/js/components/layout/document-bar.reel/document-bar.js
@@ -61,6 +61,27 @@ exports.DocumentBar = Montage.create(Component, {
61 } 61 }
62 // 62 //
63 this.visible = true; 63 this.visible = true;
64
65 //TODO: check if the code's options bar can be unified
66 if(this._currentDocument && this._currentDocument.model && (this._currentDocument.model.views.design === null) && (this._currentDocument.model.views.code !== null)){
67 this.visible = false;
68 }
69 }
70 },
71 ////////////////////////////////////////////////////////////////////
72 //
73 _codeEditorWrapper:{
74 value: null
75 },
76
77 codeEditorWrapper:{
78 get : function() {
79 return this._codeEditorWrapper;
80 },
81 set : function(value) {
82 if(this._codeEditorWrapper !== value){
83 this._codeEditorWrapper = value;
84 }
64 } 85 }
65 }, 86 },
66 //////////////////////////////////////////////////////////////////// 87 ////////////////////////////////////////////////////////////////////
@@ -112,7 +133,12 @@ exports.DocumentBar = Montage.create(Component, {
112 this._zoomFactor = value; 133 this._zoomFactor = value;
113 // 134 //
114 if (!this._firstDraw) { 135 if (!this._firstDraw) {
115 this.application.ninja.stage.setZoom(value); 136 if(this._currentDocument && this._currentDocument.model && this._currentDocument.model.currentView === this._currentDocument.model.views.design){
137 this.application.ninja.stage.setZoom(value);
138 }else if(this._currentDocument && this._currentDocument.model && this._currentDocument.model.currentView === this._currentDocument.model.views.code){
139 this._zoomFactor = value;
140 if(this.codeEditorWrapper){this.codeEditorWrapper.handleZoom(value)};
141 }
116 } 142 }
117 } 143 }
118 } 144 }
@@ -191,6 +217,14 @@ exports.DocumentBar = Montage.create(Component, {
191 }, 217 },
192 //////////////////////////////////////////////////////////////////// 218 ////////////////////////////////////////////////////////////////////
193 // 219 //
220 renderCodeView: {
221 value: function () {
222 //Reloading in code view (with updates from other view)
223 this.reloadView('code', this.fileTemplate);
224 }
225 },
226 ////////////////////////////////////////////////////////////////////
227 //
194 showViewDesign: { 228 showViewDesign: {
195 value: function () { 229 value: function () {
196 // 230 //
@@ -215,6 +249,8 @@ exports.DocumentBar = Montage.create(Component, {
215 this._currentDocument.model.switchViewTo('code'); 249 this._currentDocument.model.switchViewTo('code');
216 this.btnDesign.setAttribute('class', 'inactive'); 250 this.btnDesign.setAttribute('class', 'inactive');
217 this.btnCode.removeAttribute('class'); 251 this.btnCode.removeAttribute('class');
252 var render = this.renderCodeView.bind(this._currentDocument);
253 render();
218 } 254 }
219 } 255 }
220 }, 256 },