From 7a22f7b368ef549a5b30c58a0f3900685b764bdb Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 18 May 2012 16:56:16 -0700 Subject: integrated open code view document in new dom architecture Signed-off-by: Ananya Sen --- js/document/models/text.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'js/document/models/text.js') diff --git a/js/document/models/text.js b/js/document/models/text.js index ebf9993e..5a5e86ef 100755 --- a/js/document/models/text.js +++ b/js/document/models/text.js @@ -7,7 +7,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot //////////////////////////////////////////////////////////////////////// // var Montage = require("montage/core/core").Montage, - BaseDocumentModel = require("js/document/models/text").BaseDocumentModel; + BaseDocumentModel = require("js/document/models/base").BaseDocumentModel; //////////////////////////////////////////////////////////////////////// // exports.TextDocumentModel = Montage.create(BaseDocumentModel, { @@ -17,8 +17,6 @@ exports.TextDocumentModel = Montage.create(BaseDocumentModel, { enumerable: false, value: false } - //////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////// }); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// \ No newline at end of file -- cgit v1.2.3 From 6f5ffa17c72dd0aef7a02e3496154514750143c2 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 18 May 2012 18:38:09 -0700 Subject: save for code view documents in the new dom architecture Signed-off-by: Ananya Sen --- js/document/models/text.js | 53 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'js/document/models/text.js') diff --git a/js/document/models/text.js b/js/document/models/text.js index 5a5e86ef..d21666d0 100755 --- a/js/document/models/text.js +++ b/js/document/models/text.js @@ -16,7 +16,58 @@ exports.TextDocumentModel = Montage.create(BaseDocumentModel, { hasTemplate: { enumerable: false, value: false - } + }, +//////////////////////////////////////////////////////////////////// + // + save: { + enumerable: false, + value: function (callback) { + this.application.ninja.documentController.activeDocument.model.views.code.editor.save();//save to textarea + + var self = this; + + this.application.ninja.ioMediator.fileSave({ + mode: ""+ self.file.extension, + file: self.file, + content:self.views.code.textArea.value + }, this.handleSaved.bind({callback: callback, model: this})); + } + }, +//////////////////////////////////////////////////////////////////// + // + handleSaved: { + value: function (result) { + // + if (result.status === 204) { + this.model.needsSave = false; + } + // + if (this.callback) this.callback(result); + } + }, + //////////////////////////////////////////////////////////////////// + // + close: { + value: function (view, callback) { + //Outcome of close (pending on save logic) + var success; + // + if (this.needsSave) { + //Prompt user to save of lose data + } else { + //Close file + success = true; + } + // + this.views.code.textParentContainer.removeChild(this.views.code.textViewContainer); + this.views.code.restoreAllPanels(); + this.views.code.showCodeViewBar(false); + this.views.code = null; + + // + return success; + } + } }); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// \ No newline at end of file -- cgit v1.2.3 From c3c2ffc8d057660b7c42b45442885cd0d2d598bc Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Sun, 20 May 2012 15:16:06 -0700 Subject: use documents parent container property Signed-off-by: Ananya Sen --- js/document/models/text.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document/models/text.js') diff --git a/js/document/models/text.js b/js/document/models/text.js index d21666d0..fe02953c 100755 --- a/js/document/models/text.js +++ b/js/document/models/text.js @@ -59,7 +59,7 @@ exports.TextDocumentModel = Montage.create(BaseDocumentModel, { success = true; } // - this.views.code.textParentContainer.removeChild(this.views.code.textViewContainer); + this.parentContainer.removeChild(this.views.code.textViewContainer); this.views.code.restoreAllPanels(); this.views.code.showCodeViewBar(false); this.views.code = null; -- cgit v1.2.3 From 2cc8e58f6bb9f64a7473e62aecd013fa55167231 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 21 May 2012 16:42:26 -0700 Subject: - added opening multiple code and design view documents - switching between multiple code and design view documents - Note: closing of documents, when multiple documents are open, is not yet implemented Signed-off-by: Ananya Sen --- js/document/models/text.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/document/models/text.js') diff --git a/js/document/models/text.js b/js/document/models/text.js index fe02953c..d1252b7d 100755 --- a/js/document/models/text.js +++ b/js/document/models/text.js @@ -60,8 +60,8 @@ exports.TextDocumentModel = Montage.create(BaseDocumentModel, { } // this.parentContainer.removeChild(this.views.code.textViewContainer); - this.views.code.restoreAllPanels(); - this.views.code.showCodeViewBar(false); + this.application.ninja.stage.showCodeViewBar(false); + this.application.ninja.stage.restoreAllPanels(); this.views.code = null; // -- cgit v1.2.3