aboutsummaryrefslogtreecommitdiff
path: root/js/document/models
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-05 13:49:59 -0700
committerValerio Virgillito2012-06-05 13:49:59 -0700
commit9a429f22a958fe372309e241c480923b7462d426 (patch)
tree56273e3769c18c5623f9e8671f73189a75ad372a /js/document/models
parent73a62c95b5635fee903457279f0f5b57f164e0b5 (diff)
parentfe376077b6e24bb01905cd83226912e25b043308 (diff)
downloadninja-9a429f22a958fe372309e241c480923b7462d426.tar.gz
Merge pull request #263 from joseeight/Components
Saving Google Components (reel components)
Diffstat (limited to 'js/document/models')
-rwxr-xr-xjs/document/models/base.js21
1 files changed, 15 insertions, 6 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 76a5e62b..0957145a 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -99,11 +99,20 @@ exports.BaseDocumentModel = Montage.create(Component, {
99 //////////////////////////////////////////////////////////////////// 99 ////////////////////////////////////////////////////////////////////
100 //TODO: Add API to allow other browser support 100 //TODO: Add API to allow other browser support
101 browserPreview: { 101 browserPreview: {
102 value: function (browser) { 102 value: function (browser, screen, context) {
103 //Making call to show feedback screen
104 if (screen) screen.show(context);
103 //Generating URL for document 105 //Generating URL for document
104 var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]; 106 var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1];
105 //TODO: Add logic to prompt user to save (all) before preview 107 //TODO: Add logic to prompt user to save (all) before preview
106 this.saveAll(function (result) { 108 this.saveAll(null,function (success) {
109 //Making call to show feedback screen
110 if (screen) screen.hide(context);
111 //TODO: Add error handling logic
112 if (!success) {
113 console.log('Error!');
114 return;
115 }
107 //Currently only supporting current browser (Chrome, obviously) 116 //Currently only supporting current browser (Chrome, obviously)
108 switch (this.browser) { 117 switch (this.browser) {
109 case 'chrome': 118 case 'chrome':
@@ -145,7 +154,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
145 //////////////////////////////////////////////////////////////////// 154 ////////////////////////////////////////////////////////////////////
146 // 155 //
147 save: { 156 save: {
148 value: function (callback) { 157 value: function (callback, libCopyCallback) {
149 // 158 //
150 if (this.needsSave) { 159 if (this.needsSave) {
151 //Save 160 //Save
@@ -165,7 +174,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
165 head: this.views.design.iframe.contentWindow.document.head, 174 head: this.views.design.iframe.contentWindow.document.head,
166 body: this.views.design.iframe.contentWindow.document.body, 175 body: this.views.design.iframe.contentWindow.document.body,
167 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator 176 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
168 }, this.handleSaved.bind({callback: callback, model: this})); 177 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback);
169 } else { 178 } else {
170 //TODO: Add logic to save code view data 179 //TODO: Add logic to save code view data
171 } 180 }
@@ -174,7 +183,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
174 //////////////////////////////////////////////////////////////////// 183 ////////////////////////////////////////////////////////////////////
175 // 184 //
176 saveAll: { 185 saveAll: {
177 value: function (callback) { 186 value: function (callback, libCopyCallback) {
178 // 187 //
179 if (this.needsSave) { 188 if (this.needsSave) {
180 //Save 189 //Save
@@ -194,7 +203,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
194 head: this.views.design.iframe.contentWindow.document.head, 203 head: this.views.design.iframe.contentWindow.document.head,
195 body: this.views.design.iframe.contentWindow.document.body, 204 body: this.views.design.iframe.contentWindow.document.body,
196 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator 205 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
197 }, this.handleSaved.bind({callback: callback, model: this})); 206 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback);
198 } else { 207 } else {
199 //TODO: Add logic to save code view data 208 //TODO: Add logic to save code view data
200 } 209 }