From fb7a3aa9ce0d9b99dca79cfb89951b5c51523250 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 10 May 2012 14:54:38 -0700 Subject: Adding partial close functionality --- js/document/document-html.js | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'js/document/document-html.js') diff --git a/js/document/document-html.js b/js/document/document-html.js index 567e4455..e00333f0 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -70,10 +70,11 @@ exports.HtmlDocument = Montage.create(Component, { //Creating instance of HTML Document Model this.model = Montage.create(HtmlDocumentModel,{ file: {value: file}, + parentContainer: {value: document.getElementById("iframeContainer")}, //Saving reference to parent container of all views (should be changed to buckets approach views: {value: {'design': DesignDocumentView.create(), 'code': null}} //TODO: Add code view logic }); //Initiliazing views and hiding - if (this.model.views.design.initialize(document.getElementById("iframeContainer"))) { + if (this.model.views.design.initialize(this.model.parentContainer)) { //Hiding iFrame, just initiliazing this.model.views.design.hide(); } else { @@ -123,6 +124,40 @@ exports.HtmlDocument = Montage.create(Component, { //Setting opacity to be viewable after load this.model.views.design.iframe.style.opacity = 1; } + }, + //////////////////////////////////////////////////////////////////// + // + closeDocument: { + value: function () { + // + this.model.close(null, this.handleCloseDocument.bind(this)); + } + }, + //////////////////////////////////////////////////////////////////// + // + handleCloseDocument: { + value: function (success) { + //TODO: Add logic for handling success or failure + // + this.application.ninja.documentController._documents.splice(this.uuid, 1); + // + NJevent("closeDocument", this.model.file.uri); + //TODO: Delete object here + } + }, + //////////////////////////////////////////////////////////////////// + // + saveAppState: { + value: function () { + //TODO: Import functionality + } + }, + //////////////////////////////////////////////////////////////////// + // + restoreAppState: { + value: function () { + //TODO: Import functionality + } } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// -- cgit v1.2.3