aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
authorAnanya Sen2012-07-25 12:26:20 -0700
committerAnanya Sen2012-07-25 12:26:20 -0700
commit7fa0c53c14e9029d2e3960cc81edf91592fd1768 (patch)
treedb4449120f73539dc647fd5d331c0af7a5a50336 /js/document
parentbb2f1d0e9a559f44348e95ad726801a5031aea3a (diff)
downloadninja-7fa0c53c14e9029d2e3960cc81edf91592fd1768.tar.gz
added save for code view, fixed code view editor bug, reuse code editor options component in document bar
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com> Conflicts: js/document/views/design-code.js Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/models/base.js11
-rw-r--r--js/document/views/design-code.js5
2 files changed, 12 insertions, 4 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js
index c44123c3..a73b8b20 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -236,6 +236,8 @@ exports.BaseDocumentModel = Montage.create(Component, {
236 // 236 //
237 save: { 237 save: {
238 value: function (callback, libCopyCallback) { 238 value: function (callback, libCopyCallback) {
239 var self = this;
240
239 //TODO: Implement on demand logic 241 //TODO: Implement on demand logic
240 if (this.needsSave) { 242 if (this.needsSave) {
241 //Save 243 //Save
@@ -270,6 +272,15 @@ exports.BaseDocumentModel = Montage.create(Component, {
270 } 272 }
271 } else if (this.currentView === this.views.code) { 273 } else if (this.currentView === this.views.code) {
272 //TODO: Add save logic for code view 274 //TODO: Add save logic for code view
275 //save to textarea
276 self.views.code.editor.save();
277 //save to disk
278 this.application.ninja.ioMediator.fileSave({
279 mode: 'html-text',
280 file: self.file,
281 content:self.views.code.textArea.value
282 }, this.handleSaved.bind({callback: callback, model: this}));
283
273 } else { 284 } else {
274 //TODO: Error handle 285 //TODO: Error handle
275 } 286 }
diff --git a/js/document/views/design-code.js b/js/document/views/design-code.js
index 44d12549..8ad6d555 100644
--- a/js/document/views/design-code.js
+++ b/js/document/views/design-code.js
@@ -70,10 +70,7 @@ exports.DesignCodeView = Montage.create(CodeDocumentView, {
70 // 70 //
71 show: { 71 show: {
72 value: function (callback) { 72 value: function (callback) {
73 73 this.textViewContainer.setAttribute("class", "codeViewContainer cm-s-default");
74 this.textViewContainer.style.display = "block";
75 this.textViewContainer.style.background = "white";
76 this.textViewContainer.style.height = "100%";
77 74
78 //todo : update options bar 75 //todo : update options bar
79 76