aboutsummaryrefslogtreecommitdiff
path: root/js/document/models/base.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/models/base.js')
-rwxr-xr-xjs/document/models/base.js45
1 files changed, 42 insertions, 3 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js
index c7e2de69..c44123c3 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -88,9 +88,26 @@ 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 },
109 ////////////////////////////////////////////////////////////////////
110 //
94 domContainer: { 111 domContainer: {
95 value: null 112 value: null
96 }, 113 },
@@ -120,7 +137,8 @@ exports.BaseDocumentModel = Montage.create(Component, {
120 libs: { 137 libs: {
121 value: null 138 value: null
122 }, 139 },
123 140 ////////////////////////////////////////////////////////////////////
141 //
124 _mObjects: { 142 _mObjects: {
125 value: [] 143 value: []
126 }, 144 },
@@ -138,6 +156,23 @@ exports.BaseDocumentModel = Montage.create(Component, {
138 switchViewTo: { 156 switchViewTo: {
139 value: function (view) { 157 value: function (view) {
140 // 158 //
159 switch (view) {
160 case 'design':
161 //
162 if (this.views.design) this.views.design.show();
163 if (this.views.code) this.views.code.hide();
164 this.currentView = this.views.design;
165 break;
166 case 'code':
167 //
168 if (this.views.code) this.views.code.show();
169 if (this.views.design) this.views.design.hide();
170 this.currentView = this.views.code;
171 break;
172 default:
173 //Error
174 break;
175 }
141 } 176 }
142 }, 177 },
143 //////////////////////////////////////////////////////////////////// 178 ////////////////////////////////////////////////////////////////////
@@ -233,8 +268,10 @@ exports.BaseDocumentModel = Montage.create(Component, {
233 this.libs.canvas = true; 268 this.libs.canvas = true;
234 } 269 }
235 } 270 }
271 } else if (this.currentView === this.views.code) {
272 //TODO: Add save logic for code view
236 } else { 273 } else {
237 //TODO: Add logic to save code view data 274 //TODO: Error handle
238 } 275 }
239 } 276 }
240 }, 277 },
@@ -274,8 +311,10 @@ exports.BaseDocumentModel = Montage.create(Component, {
274 this.libs.canvas = true; 311 this.libs.canvas = true;
275 } 312 }
276 } 313 }
314 } else if (this.currentView === this.views.code) {
315 //TODO: Add save logic for code view
277 } else { 316 } else {
278 //TODO: Add logic to save code view data 317 //TODO: Error handle
279 } 318 }
280 319
281 } 320 }