aboutsummaryrefslogtreecommitdiff
path: root/js/document/models
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-07 16:51:12 -0700
committerValerio Virgillito2012-06-07 16:51:12 -0700
commita67e6e8783dcdfd3a3bbcff36dc086dded6c7656 (patch)
treeb83651847aa578cdd3ed023e9e8bfee131118f0d /js/document/models
parent2e331fc1daba0f6f29191a36cf7647f6f5dc36ee (diff)
parent25fa6978470c296bd40321d5aa3046d34062ecd8 (diff)
downloadninja-a67e6e8783dcdfd3a3bbcff36dc086dded6c7656.tar.gz
Merge pull request #281 from joseeight/FileIO
Adding partial unique ID to data files
Diffstat (limited to 'js/document/models')
-rwxr-xr-xjs/document/models/base.js41
-rwxr-xr-xjs/document/models/html.js2
2 files changed, 35 insertions, 8 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js
index a3644815..5fa06259 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -68,12 +68,8 @@ exports.BaseDocumentModel = Montage.create(Component, {
68 //////////////////////////////////////////////////////////////////// 68 ////////////////////////////////////////////////////////////////////
69 // 69 //
70 selection: { 70 selection: {
71 get: function() { 71 get: function() {return this._selection;},
72 return this._selection; 72 set: function(value) {this._selection = value;}
73 },
74 set: function(value) {
75 this._selection = value;
76 }
77 }, 73 },
78 //////////////////////////////////////////////////////////////////// 74 ////////////////////////////////////////////////////////////////////
79 // 75 //
@@ -92,6 +88,11 @@ exports.BaseDocumentModel = Montage.create(Component, {
92 }, 88 },
93 //////////////////////////////////////////////////////////////////// 89 ////////////////////////////////////////////////////////////////////
94 // 90 //
91 libs: {
92 value: null
93 },
94 ////////////////////////////////////////////////////////////////////
95 //
95 switchViewTo: { 96 switchViewTo: {
96 value: function (view) { 97 value: function (view) {
97 // 98 //
@@ -167,8 +168,9 @@ exports.BaseDocumentModel = Montage.create(Component, {
167 // 168 //
168 if (this.currentView === this.views.design) { 169 if (this.currentView === this.views.design) {
169 // 170 //
170 this.application.ninja.ioMediator.fileSave({ 171 var save = this.application.ninja.ioMediator.fileSave({
171 mode: 'html', 172 mode: 'html',
173 libs: this.libs,
172 file: this.file, 174 file: this.file,
173 webgl: this.webGlHelper.glData, 175 webgl: this.webGlHelper.glData,
174 styles: this.getStyleSheets(), 176 styles: this.getStyleSheets(),
@@ -178,6 +180,17 @@ exports.BaseDocumentModel = Montage.create(Component, {
178 body: this.views.design.iframe.contentWindow.document.body, 180 body: this.views.design.iframe.contentWindow.document.body,
179 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator 181 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
180 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); 182 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback);
183 //TODO: Improve detection during save routine
184 if (save) {
185 if (save.montageId) {
186 this.libs.montageId = save.montageId;
187 this.libs.montage = true;
188 }
189 if (save.canvasId) {
190 this.libs.canvasId = save.canvasId;
191 this.libs.canvas = true;
192 }
193 }
181 } else { 194 } else {
182 //TODO: Add logic to save code view data 195 //TODO: Add logic to save code view data
183 } 196 }
@@ -196,8 +209,9 @@ exports.BaseDocumentModel = Montage.create(Component, {
196 // 209 //
197 if (this.currentView === this.views.design) { 210 if (this.currentView === this.views.design) {
198 // 211 //
199 this.application.ninja.ioMediator.fileSave({ 212 var save = this.application.ninja.ioMediator.fileSave({
200 mode: 'html', 213 mode: 'html',
214 libs: this.libs,
201 file: this.file, 215 file: this.file,
202 webgl: this.webGlHelper.glData, 216 webgl: this.webGlHelper.glData,
203 css: this.getStyleSheets(), 217 css: this.getStyleSheets(),
@@ -207,6 +221,17 @@ exports.BaseDocumentModel = Montage.create(Component, {
207 body: this.views.design.iframe.contentWindow.document.body, 221 body: this.views.design.iframe.contentWindow.document.body,
208 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator 222 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
209 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback); 223 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback);
224 //TODO: Improve detection during save routine
225 if (save) {
226 if (save.montageId) {
227 this.libs.montageId = save.montageId;
228 this.libs.montage = true;
229 }
230 if (save.canvasId) {
231 this.libs.canvasId = save.canvasId;
232 this.libs.canvas = true;
233 }
234 }
210 } else { 235 } else {
211 //TODO: Add logic to save code view data 236 //TODO: Add logic to save code view data
212 } 237 }
diff --git a/js/document/models/html.js b/js/document/models/html.js
index 6bdc6546..7064c6e3 100755
--- a/js/document/models/html.js
+++ b/js/document/models/html.js
@@ -23,6 +23,8 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, {
23 value:function() { 23 value:function() {
24 //Creating instance of the webGL helper for this model 24 //Creating instance of the webGL helper for this model
25 this.webGlHelper = webGlDocumentHelper.create(); 25 this.webGlHelper = webGlDocumentHelper.create();
26 //
27 this.libs = {montage: false, canvas: false, montageId: null, canvasId: null};
26 } 28 }
27 }, 29 },
28 //////////////////////////////////////////////////////////////////// 30 ////////////////////////////////////////////////////////////////////