diff options
author | Ananya Sen | 2012-06-05 16:13:49 -0700 |
---|---|---|
committer | Ananya Sen | 2012-06-05 16:13:49 -0700 |
commit | 71ee2afc745277a8459c0c82d0829f1302956122 (patch) | |
tree | cca1a92b8fe4b39d3f179add496205c113ac6024 /js/document/models | |
parent | e82a0dac35fcea2d1ce7bcbb3e89c822c87d774f (diff) | |
parent | b23a684a6aba38946867463bbbf4184ba2a2ff4a (diff) | |
download | ninja-71ee2afc745277a8459c0c82d0829f1302956122.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into bugfix-master
Diffstat (limited to 'js/document/models')
-rwxr-xr-x | js/document/models/base.js | 21 |
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 | } |