aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js15
-rwxr-xr-xjs/document/models/base.js15
-rwxr-xr-xjs/document/views/code.js4
-rw-r--r--js/document/views/design-code.js27
-rwxr-xr-xjs/document/views/design.js4
5 files changed, 35 insertions, 30 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index a59f5848..f3163339 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -164,7 +164,7 @@ exports.HtmlDocument = Montage.create(Component, {
164 //Adding observer to know when template is ready 164 //Adding observer to know when template is ready
165 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this)); 165 this._observer = new WebKitMutationObserver(this.handleTemplateReady.bind(this));
166 this._observer.observe(this.model.views.design.document.head, {childList: true}); 166 this._observer.observe(this.model.views.design.document.head, {childList: true});
167 }.bind(this), template, {viewCallback: this.handleViewReady, context: this}); 167 }.bind(this), template, {viewCallback: this.handleReloadViewReady, context: this});
168 } else if(view === 'code'){ 168 } else if(view === 'code'){
169 //TODO: Add logic to handle external changed files 169 //TODO: Add logic to handle external changed files
170 //Checking for template type and not saving external data 170 //Checking for template type and not saving external data
@@ -176,6 +176,7 @@ exports.HtmlDocument = Montage.create(Component, {
176 //Setting current view object to code 176 //Setting current view object to code
177 this.currentView = 'code'; 177 this.currentView = 'code';
178 this.model.currentView = this.model.views.code; 178 this.model.currentView = this.model.views.code;
179 this.model.currentViewIdentifier = this.model.currentView.identifier;
179 } else { 180 } else {
180 //TODO: Identify default view (probably code) - Error handling 181 //TODO: Identify default view (probably code) - Error handling
181 } 182 }
@@ -200,10 +201,22 @@ exports.HtmlDocument = Montage.create(Component, {
200 if(typeof this.model.domContainer !== "undefined") { 201 if(typeof this.model.domContainer !== "undefined") {
201 this.model.domContainer = this.model.documentRoot; 202 this.model.domContainer = this.model.documentRoot;
202 } 203 }
204 this.model.currentViewIdentifier = this.model.currentView.identifier;
203 //Making callback after view is loaded 205 //Making callback after view is loaded
204 this.loaded.callback.call(this.loaded.context, this); 206 this.loaded.callback.call(this.loaded.context, this);
205 } 207 }
206 }, 208 },
209 handleReloadViewReady: {
210 value: function(mObjects) {
211 this.model.mObjects = mObjects;
212 // TODO: Find a better way to initialize this property
213 // Assign the domContainer to be the document root on open
214 if(typeof this.model.domContainer !== "undefined") {
215 this.model.domContainer = this.model.documentRoot;
216 }
217 this.model.currentViewIdentifier = this.model.currentView.identifier;
218 }
219 },
207 //////////////////////////////////////////////////////////////////// 220 ////////////////////////////////////////////////////////////////////
208 // 221 //
209 closeDocument: { 222 closeDocument: {
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 85a0414f..c44123c3 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -88,6 +88,21 @@ exports.BaseDocumentModel = Montage.create(Component, {
88 }, 88 },
89 //////////////////////////////////////////////////////////////////// 89 ////////////////////////////////////////////////////////////////////
90 // 90 //
91 _currentViewIdentifier: {
92 value: ""
93 },
94 ////////////////////////////////////////////////////////////////////
95 //
96 currentViewIdentifier: {
97 get: function() {
98 return this._currentViewIdentifier;
99 },
100 set: function(value) {
101 this._currentViewIdentifier = value;
102 }
103 },
104 ////////////////////////////////////////////////////////////////////
105 //
91 _selection: { 106 _selection: {
92 value: [] 107 value: []
93 }, 108 },
diff --git a/js/document/views/code.js b/js/document/views/code.js
index 05f671b2..0ca87fa9 100755
--- a/js/document/views/code.js
+++ b/js/document/views/code.js
@@ -39,8 +39,8 @@ var Montage = require("montage/core/core").Montage,
39exports.CodeDocumentView = Montage.create(BaseDocumentView, { 39exports.CodeDocumentView = Montage.create(BaseDocumentView, {
40 //////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////
41 // 41 //
42 hasTemplate: { 42 identifier: {
43 value: false 43 value: "code"
44 }, 44 },
45 //////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////
46 // 46 //
diff --git a/js/document/views/design-code.js b/js/document/views/design-code.js
index 25073833..44d12549 100644
--- a/js/document/views/design-code.js
+++ b/js/document/views/design-code.js
@@ -40,8 +40,8 @@ var Montage = require("montage/core/core").Montage,
40exports.DesignCodeView = Montage.create(CodeDocumentView, { 40exports.DesignCodeView = Montage.create(CodeDocumentView, {
41 //////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////
42 // 42 //
43 hasTemplate: { 43 identifier: {
44 value: false 44 value: "design-code"
45 }, 45 },
46 //////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////
47 // 47 //
@@ -75,22 +75,6 @@ exports.DesignCodeView = Montage.create(CodeDocumentView, {
75 this.textViewContainer.style.background = "white"; 75 this.textViewContainer.style.background = "white";
76 this.textViewContainer.style.height = "100%"; 76 this.textViewContainer.style.height = "100%";
77 77
78
79 ///todo-remove after the switch view logic is added in all the components
80 this.application.ninja.stage.collapseAllPanels();
81 this.application.ninja.stage.hideCanvas(true);
82 this.application.ninja.stage.hideRulers();
83
84 document.getElementsByClassName("bindingView")[0].style.display = "none";
85
86 //bindingView div needs to be display noned
87 //timeline error on switching back to design view
88
89 ///-end todo-remove
90
91
92
93
94 //todo : update options bar 78 //todo : update options bar
95 79
96 // 80 //
@@ -106,13 +90,6 @@ exports.DesignCodeView = Montage.create(CodeDocumentView, {
106 } 90 }
107 this.textViewContainer.style.display = "none"; 91 this.textViewContainer.style.display = "none";
108 92
109 ///todo-remove after the switch view logic is added in all the components
110 this.application.ninja.stage.restoreAllPanels(false);
111 this.application.ninja.stage.hideCanvas(false);
112 this.application.ninja.stage.showRulers();
113 ///-end todo-remove
114
115
116 //todo : update options bar 93 //todo : update options bar
117 94
118 // 95 //
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 548e45e9..97558408 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -39,8 +39,8 @@ var Montage = require("montage/core/core").Montage,
39exports.DesignDocumentView = Montage.create(BaseDocumentView, { 39exports.DesignDocumentView = Montage.create(BaseDocumentView, {
40 //////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////
41 // 41 //
42 hasTemplate: { 42 identifier: {
43 value: false 43 value: "design"
44 }, 44 },
45 //////////////////////////////////////////////////////////////////// 45 ////////////////////////////////////////////////////////////////////
46 // 46 //