aboutsummaryrefslogtreecommitdiff
path: root/js/components/layout/document-bar.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/components/layout/document-bar.reel')
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.js63
1 files changed, 26 insertions, 37 deletions
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js
index 803d2c3a..f5e61a18 100755
--- a/js/components/layout/document-bar.reel/document-bar.js
+++ b/js/components/layout/document-bar.reel/document-bar.js
@@ -73,12 +73,12 @@ exports.DocumentBar = Montage.create(Component, {
73 _codeEditorWrapper:{ 73 _codeEditorWrapper:{
74 value: null 74 value: null
75 }, 75 },
76 76 ////////////////////////////////////////////////////////////////////
77 //
77 codeEditorWrapper:{ 78 codeEditorWrapper:{
78 get : function() { 79 get: function() {return this._codeEditorWrapper;},
79 return this._codeEditorWrapper; 80 set: function(value) {
80 }, 81 //
81 set : function(value) {
82 if(this._codeEditorWrapper !== value){ 82 if(this._codeEditorWrapper !== value){
83 this._codeEditorWrapper = value; 83 this._codeEditorWrapper = value;
84 } 84 }
@@ -89,9 +89,13 @@ exports.DocumentBar = Montage.create(Component, {
89 btnCode: { 89 btnCode: {
90 value: null 90 value: null
91 }, 91 },
92 ////////////////////////////////////////////////////////////////////
93 //
92 btnDesign: { 94 btnDesign: {
93 value: null 95 value: null
94 }, 96 },
97 ////////////////////////////////////////////////////////////////////
98 //
95 btnPreview: { 99 btnPreview: {
96 value: null 100 value: null
97 }, 101 },
@@ -209,52 +213,37 @@ exports.DocumentBar = Montage.create(Component, {
209 }, 213 },
210 //////////////////////////////////////////////////////////////////// 214 ////////////////////////////////////////////////////////////////////
211 // 215 //
212 renderDesignView: { 216 showViewDesign: {
213 value: function () { 217 value: function () {
214 //Reloading in design view (with updates from other view) 218 //
215 this.reloadView('design', this.fileTemplate); 219 this.showView('design', this.renderDesignView, this.btnDesign, this.btnCode);
216 } 220 }
217 }, 221 },
218 //////////////////////////////////////////////////////////////////// 222 ////////////////////////////////////////////////////////////////////
219 // 223 //
220 renderCodeView: { 224 showViewCode: {
221 value: function () { 225 value: function () {
222 //Reloading in code view (with updates from other view) 226 //
223 this.reloadView('code', this.fileTemplate); 227 this.showView('code', this.renderCodeView, this.btnCode, this.btnDesign);
224 } 228 }
225 }, 229 },
226 //////////////////////////////////////////////////////////////////// 230 ////////////////////////////////////////////////////////////////////
227 // 231 //
228 showViewDesign: { 232 showView: {
229 value: function () { 233 value: function (view, render, aBtn, iBtn) {
230 // 234 //TODO: Remove reference to string view
231 if (this._currentDocument.model.currentView !== 'design') { 235 if (this._currentDocument.model.currentView !== view) {
232 // 236 //
233 this._currentDocument.model.switchViewTo('design'); 237 this._currentDocument.model.switchViewTo(view);
234 this.btnCode.setAttribute('class', 'inactive'); 238 iBtn.setAttribute('class', 'inactive');
235 this.btnDesign.removeAttribute('class'); 239 aBtn.removeAttribute('class');
236 //this._currentDocument.model.file.content.body = '<div class="test">hello</div><div class="test">hello</div>'; 240 //TODO: Add document parsing to reload view
237 var render = this.renderDesignView.bind(this._currentDocument); 241 this._currentDocument.reloadView(view, this.fileTemplate);
238 render();
239 } 242 }
240 } 243 }
241 }, 244 },
242 //////////////////////////////////////////////////////////////////// 245 ////////////////////////////////////////////////////////////////////
243 //TODO: Implement code with that updates the file template through the ninja document parser 246 //
244 showViewCode: {
245 value: function () {
246 //
247 if (this._currentDocument.model.currentView !== 'code') {
248 //
249 this._currentDocument.model.switchViewTo('code');
250 this.btnDesign.setAttribute('class', 'inactive');
251 this.btnCode.removeAttribute('class');
252 var render = this.renderCodeView.bind(this._currentDocument);
253 render();
254 }
255 }
256 },
257
258 handleClick: { 247 handleClick: {
259 value: function(evt) { 248 value: function(evt) {
260 NJevent("executePreview"); 249 NJevent("executePreview");