From 9048cd50bf5e0a418d1d95498bb593961f72db36 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 09:51:12 -0800 Subject: Revert "Reverting text/html document classes and setting up MVC folder structure" This reverts commit 68ce64a5a2f4a71b54d33916aaf1d57161302425. Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index f397ace7..25f60cc5 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/document/html-document").HTMLDocument, - TextDocument = require("js/document/text-document").TextDocument, + HTMLDocument = require("js/document/models/html-document").HTMLDocument, + BaseDocument = require("js/document/models/base-document").BaseDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // @@ -28,7 +28,13 @@ DocumentController = exports.DocumentController = Montage.create(Component, { _iframeHolder: { value: null, enumerable: false }, _textHolder: { value: null, enumerable: false }, _codeMirrorCounter: {value: 1, enumerable: false}, - + + tmpSourceForTesting: { + value: "function CodeMirror(place, givenOptions) {" + + "// Determine effective options based on given values and defaults." + + "var options = {}, defaults = CodeMirror.defaults; }" + }, + activeDocument: { get: function() { return this._activeDocument; @@ -56,12 +62,21 @@ DocumentController = exports.DocumentController = Montage.create(Component, { this.eventManager.addEventListener("executeSave", this, false); this.eventManager.addEventListener("recordStyleChanged", this, false); + + // Temporary testing opening a new file after Ninja has loaded + this.eventManager.addEventListener("executeNewProject", this, false); } }, handleAppLoaded: { value: function() { - // + //this.openDocument({"type": "html"}); + } + }, + + handleExecuteNewProject: { + value: function() { + this.openDocument({"type": "html"}); } }, @@ -188,7 +203,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { break; default: //Open in code view - var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; + var code = Montage.create(BaseDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid); code.initialize(doc, docuuid, textArea, textArea.parentNode); //code.init(doc.name, doc.uri, doc.extension, null, docuuid); -- cgit v1.2.3 From a90e3be8850b64e8e370aa8ff8cadaa448dd0c82 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 09:58:37 -0800 Subject: Revert "Cleaning up" This reverts commit a7952c5a16e2cae3fd1a459b03b9f16bba1004da. Conflicts: js/controllers/document-controller.js js/io/document/text-document.js Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 25f60cc5..9ece27f9 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/document/models/html-document").HTMLDocument, - BaseDocument = require("js/document/models/base-document").BaseDocument, + HTMLDocument = require("js/io/document/html-document").HTMLDocument, + TextDocument = require("js/io/document/text-document").TextDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3 From b8782f2e3dd106accbb0160a98e6b498f26752ea Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 10:01:59 -0800 Subject: Revert "Merging TextDocument into BaseDocument" This reverts commit 93c8f327d662a7693d1d6ca050a0efd15ebc18ed. Conflicts: js/controllers/document-controller.js Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 9ece27f9..9b412576 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/io/document/html-document").HTMLDocument, - TextDocument = require("js/io/document/text-document").TextDocument, + HTMLDocument = require("js/document/models/html-document").HTMLDocument, + TextDocument = require("js/document/models/text-document").TextDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // @@ -203,7 +203,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { break; default: //Open in code view - var code = Montage.create(BaseDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; + var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid); code.initialize(doc, docuuid, textArea, textArea.parentNode); //code.init(doc.name, doc.uri, doc.extension, null, docuuid); -- cgit v1.2.3 From 3cf1d19c5cdc9534d9c87cbc7d1fcf48e68daa42 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 10:06:42 -0800 Subject: merging from github.com/joseeight/ninja-internal/tree/FileIO is breaking opening html files… to trying to fix local build Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 9b412576..7d38c600 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/document/models/html-document").HTMLDocument, - TextDocument = require("js/document/models/text-document").TextDocument, + HTMLDocument = require("js/io/document/html-document").HTMLDocument, + TextDocument = require("js/io/document/text-document").TextDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3 From e864dc319805e259b7ae39a9d4d96fac552a1f87 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 10:52:38 -0800 Subject: Revert "merging from github.com/joseeight/ninja-internal/tree/FileIO is breaking opening html files… to trying to fix local build" This reverts commit 3cf1d19c5cdc9534d9c87cbc7d1fcf48e68daa42. Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 7d38c600..9b412576 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/io/document/html-document").HTMLDocument, - TextDocument = require("js/io/document/text-document").TextDocument, + HTMLDocument = require("js/document/models/html-document").HTMLDocument, + TextDocument = require("js/document/models/text-document").TextDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3 From a8d1a2e1f4f4ab7b9298bfbd1b49731785c79c3a Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 10:52:56 -0800 Subject: Revert "Revert "Merging TextDocument into BaseDocument"" This reverts commit b8782f2e3dd106accbb0160a98e6b498f26752ea. Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 9b412576..9ece27f9 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/document/models/html-document").HTMLDocument, - TextDocument = require("js/document/models/text-document").TextDocument, + HTMLDocument = require("js/io/document/html-document").HTMLDocument, + TextDocument = require("js/io/document/text-document").TextDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // @@ -203,7 +203,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { break; default: //Open in code view - var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; + var code = Montage.create(BaseDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid); code.initialize(doc, docuuid, textArea, textArea.parentNode); //code.init(doc.name, doc.uri, doc.extension, null, docuuid); -- cgit v1.2.3 From aead95ce4b2571356701229567bfde73d54bed93 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 10:53:55 -0800 Subject: Revert "Revert "Cleaning up"" This reverts commit a90e3be8850b64e8e370aa8ff8cadaa448dd0c82. Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 9ece27f9..25f60cc5 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/io/document/html-document").HTMLDocument, - TextDocument = require("js/io/document/text-document").TextDocument, + HTMLDocument = require("js/document/models/html-document").HTMLDocument, + BaseDocument = require("js/document/models/base-document").BaseDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // -- cgit v1.2.3 From e2b97c951a9a5a0c4ff831d44fdd82177cbd82ad Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 10:54:14 -0800 Subject: Revert "Revert "Reverting text/html document classes and setting up MVC folder structure"" This reverts commit 9048cd50bf5e0a418d1d95498bb593961f72db36. Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 25f60cc5..f397ace7 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -9,8 +9,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component, Uuid = require("montage/core/uuid").Uuid, - HTMLDocument = require("js/document/models/html-document").HTMLDocument, - BaseDocument = require("js/document/models/base-document").BaseDocument, + HTMLDocument = require("js/document/html-document").HTMLDocument, + TextDocument = require("js/document/text-document").TextDocument, DocumentController; //////////////////////////////////////////////////////////////////////// // @@ -28,13 +28,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { _iframeHolder: { value: null, enumerable: false }, _textHolder: { value: null, enumerable: false }, _codeMirrorCounter: {value: 1, enumerable: false}, - - tmpSourceForTesting: { - value: "function CodeMirror(place, givenOptions) {" + - "// Determine effective options based on given values and defaults." + - "var options = {}, defaults = CodeMirror.defaults; }" - }, - + activeDocument: { get: function() { return this._activeDocument; @@ -62,21 +56,12 @@ DocumentController = exports.DocumentController = Montage.create(Component, { this.eventManager.addEventListener("executeSave", this, false); this.eventManager.addEventListener("recordStyleChanged", this, false); - - // Temporary testing opening a new file after Ninja has loaded - this.eventManager.addEventListener("executeNewProject", this, false); } }, handleAppLoaded: { value: function() { - //this.openDocument({"type": "html"}); - } - }, - - handleExecuteNewProject: { - value: function() { - this.openDocument({"type": "html"}); + // } }, @@ -203,7 +188,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { break; default: //Open in code view - var code = Montage.create(BaseDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; + var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea; textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid); code.initialize(doc, docuuid, textArea, textArea.parentNode); //code.init(doc.name, doc.uri, doc.extension, null, docuuid); -- cgit v1.2.3 From 4937b39fb0cf542f57cdadc7d1e2ed9798f7ef87 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 15 Feb 2012 16:09:14 -0800 Subject: fixes to document tabbing Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index f397ace7..b1a22c1b 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -34,17 +34,17 @@ DocumentController = exports.DocumentController = Montage.create(Component, { return this._activeDocument; }, set: function(doc) { - if(this._activeDocument) this._activeDocument.isActive = false; - - if(this._documents.indexOf(doc) === -1) this._documents.push(doc); + if(!!this._activeDocument) this._activeDocument.isActive = false; this._activeDocument = doc; - this._activeDocument.isActive = true; + if(!!this._activeDocument){ - if(!!this._activeDocument.editor){ - this._activeDocument.editor.focus(); + if(this._documents.indexOf(doc) === -1) this._documents.push(doc); + this._activeDocument.isActive = true; + if(!!this._activeDocument.editor){ + this._activeDocument.editor.focus(); + } } - } }, @@ -184,7 +184,7 @@ DocumentController = exports.DocumentController = Montage.create(Component, { switch (doc.extension) { case 'html': case 'html': //Open in designer view - Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument); + Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this)); break; default: //Open in code view @@ -250,7 +250,6 @@ DocumentController = exports.DocumentController = Montage.create(Component, { } var doc = this._findDocumentByUUID(id); - this._removeDocumentView(doc.container); var closeDocumentIndex = this._findIndexByUUID(id); this._documents.splice(this._findIndexByUUID(id), 1); @@ -263,8 +262,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, { nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); + this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ - //if there are no documents to switch to then just show the iframeContainer + this.activeDocument = null; + this._removeDocumentView(doc.container); + this.application.ninja.stage.stageView.hideRulers(); document.getElementById("iframeContainer").style.display="block"; } } @@ -275,11 +277,15 @@ DocumentController = exports.DocumentController = Montage.create(Component, { _onOpenDocument: { value: function(doc){ //var data = DocumentManager.activeDocument; - //DocumentManager._hideCurrentDocument(); - //stageManagerModule.stageManager.toggleCanvas(); + this._hideCurrentDocument(); + this.application.ninja.stage.stageView.hideOtherDocuments(doc.uuid); + + this.application.ninja.stage.hideCanvas(false); + + this.activeDocument = doc; - DocumentController.activeDocument = doc; + this._showCurrentDocument(); NJevent("onOpenDocument", doc); // appDelegateModule.MyAppDelegate.onSetActiveDocument(); -- cgit v1.2.3 From f3b6a62f110be31a9438a6172694b111ffd4d507 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 17 Feb 2012 11:07:42 -0800 Subject: -added keyboard control for saving documents -mark html design view when element is added or deleted Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index b1a22c1b..6f31e24d 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -50,12 +50,21 @@ DocumentController = exports.DocumentController = Montage.create(Component, { deserializedFromTemplate: { value: function() { + var self = this; + this.eventManager.addEventListener("appLoaded", this, false); this.eventManager.addEventListener("executeFileOpen", this, false); this.eventManager.addEventListener("executeNewFile", this, false); this.eventManager.addEventListener("executeSave", this, false); this.eventManager.addEventListener("recordStyleChanged", this, false); + + //event listener to detect a change in the html design view + this.eventManager.addEventListener("elementAdded", function(evt){self.markCurrentDocumentChanged()}, false); + this.eventManager.addEventListener("elementDeleted", function(evt){self.markCurrentDocumentChanged()}, false); + //todo: add all applicable event listeners + //end-event listener to detect a change in the html design view + } }, @@ -88,8 +97,10 @@ DocumentController = exports.DocumentController = Montage.create(Component, { //TODO: Check for appropiate structures handleExecuteSave: { value: function(event) { - //Text and HTML document classes should return the same save object for fileSave - this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); + if(!!this.activeDocument){ + //Text and HTML document classes should return the same save object for fileSave + this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); + } } }, //////////////////////////////////////////////////////////////////// @@ -427,5 +438,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, { value: function() { return "userDocument_" + (this._iframeCounter++); } + }, + + markCurrentDocumentChanged:{ + value: function(){ + this.activeDocument.dirtyFlag = true; } + } }); -- cgit v1.2.3 From 3b862fe489a3320882f91ab56781fc5dc400c3d1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Fri, 17 Feb 2012 11:26:02 -0800 Subject: changed the document dirtying logic to be done in the feature that edits the document. Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 6f31e24d..232af4c9 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -59,12 +59,6 @@ DocumentController = exports.DocumentController = Montage.create(Component, { this.eventManager.addEventListener("recordStyleChanged", this, false); - //event listener to detect a change in the html design view - this.eventManager.addEventListener("elementAdded", function(evt){self.markCurrentDocumentChanged()}, false); - this.eventManager.addEventListener("elementDeleted", function(evt){self.markCurrentDocumentChanged()}, false); - //todo: add all applicable event listeners - //end-event listener to detect a change in the html design view - } }, @@ -438,11 +432,5 @@ DocumentController = exports.DocumentController = Montage.create(Component, { value: function() { return "userDocument_" + (this._iframeCounter++); } - }, - - markCurrentDocumentChanged:{ - value: function(){ - this.activeDocument.dirtyFlag = true; - } } }); -- cgit v1.2.3 From 6787b29cfaa723c5c181baeb05160cfd4aadfe0f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 19 Feb 2012 17:27:09 -0800 Subject: Clean up and repairing manifest --- js/controllers/document-controller.js | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 57289448..c31ffbac 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -66,35 +66,37 @@ var DocumentController = exports.DocumentController = Montage.create(Component, + + + + + //////////////////////////////////////////////////////////////////// + // handleWebRequest: { value: function (request) { - if (request.url.indexOf('js/document/templates/montage-html') !== -1) { - - console.log(request); - - //TODO: Figure out why active document is not available here - - if (this._hackRootFlag) { - - //console.log(request.url.split('/')[request.url.split('/').length-1]); - //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]); - - return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; - } + if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) { + //TODO: Optimize creating string + return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; } } }, - - + //////////////////////////////////////////////////////////////////// + // handleAppLoaded: { value: function() { - // - + //Adding an intercept to resources loaded to ensure user assets load from cloud simulator chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: [""]}, ["blocking"]); - } }, - + //////////////////////////////////////////////////////////////////// + + + + + + + + handleExecuteFileOpen: { value: function(event) { var pickerSettings = event._event.settings || {}; -- cgit v1.2.3 From 50e555587d3a97dbfc75c33f3589cfccee392180 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 20 Feb 2012 12:04:57 -0800 Subject: - moved tools specific keyboard controls for desing view only - stopped snapping when all documents are closed Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 57289448..f8507086 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -303,6 +303,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this._removeDocumentView(doc.container); this.application.ninja.stage.stageView.hideRulers(); document.getElementById("iframeContainer").style.display="block"; + + this.application.ninja.stage.hideCanvas(true); } } }, -- cgit v1.2.3 From 3251315ecc22544dab50623ee5862e00dfe02302 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 20 Feb 2012 15:15:37 -0800 Subject: check cloud availability before open file picker and new file dialogs Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index f8507086..e279d5c5 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -70,7 +70,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value: function (request) { if (request.url.indexOf('js/document/templates/montage-html') !== -1) { - console.log(request); + //console.log(request); //TODO: Figure out why active document is not available here @@ -98,18 +98,26 @@ var DocumentController = exports.DocumentController = Montage.create(Component, handleExecuteFileOpen: { value: function(event) { var pickerSettings = event._event.settings || {}; - pickerSettings.callback = this.openFileWithURI.bind(this); - pickerSettings.pickerMode = "read"; - pickerSettings.inFileMode = true; - this.application.ninja.filePickerController.showFilePicker(pickerSettings); + //adding callback so that file picker can be opened after checking cloud status + this.application.ninja.coreIoApi.cloudAvailable(function(){ + pickerSettings.callback = this.openFileWithURI.bind(this); + pickerSettings.pickerMode = "read"; + pickerSettings.inFileMode = true; + this.application.ninja.filePickerController.showFilePicker(pickerSettings); + }.bind(this)); + } }, handleExecuteNewFile: { value: function(event) { var newFileSettings = event._event.settings || {}; - newFileSettings.callback = this.createNewFile.bind(this); - this.application.ninja.newFileController.showNewFileDialog(newFileSettings); + //adding callback so that new file dialog can be opened after checking cloud status + this.application.ninja.coreIoApi.cloudAvailable(function(){ + newFileSettings.callback = this.createNewFile.bind(this); + this.application.ninja.newFileController.showNewFileDialog(newFileSettings); + }.bind(this)); + } }, -- cgit v1.2.3 From d03a7d460b8998fdee8ebac10397f0c014adeef6 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 21:53:21 -0800 Subject: Removing the log of the url requests Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 1f339fe7..c2aa1b6b 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -70,7 +70,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, value: function (request) { if (request.url.indexOf('js/document/templates/montage-html') !== -1) { - console.log(request); + //console.log(request); //TODO: Figure out why active document is not available here -- cgit v1.2.3 From 9f80fc891b7952900dabec04877606c6c8229c61 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 21 Feb 2012 09:47:05 -0800 Subject: Revert "check cloud availability before open file picker and new file dialogs" This reverts commit 3251315ecc22544dab50623ee5862e00dfe02302. Conflicts: js/controllers/document-controller.js Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 3cd2c254..9a063280 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -100,26 +100,18 @@ var DocumentController = exports.DocumentController = Montage.create(Component, handleExecuteFileOpen: { value: function(event) { var pickerSettings = event._event.settings || {}; - //adding callback so that file picker can be opened after checking cloud status - this.application.ninja.coreIoApi.cloudAvailable(function(){ - pickerSettings.callback = this.openFileWithURI.bind(this); - pickerSettings.pickerMode = "read"; - pickerSettings.inFileMode = true; - this.application.ninja.filePickerController.showFilePicker(pickerSettings); - }.bind(this)); - + pickerSettings.callback = this.openFileWithURI.bind(this); + pickerSettings.pickerMode = "read"; + pickerSettings.inFileMode = true; + this.application.ninja.filePickerController.showFilePicker(pickerSettings); } }, handleExecuteNewFile: { value: function(event) { var newFileSettings = event._event.settings || {}; - //adding callback so that new file dialog can be opened after checking cloud status - this.application.ninja.coreIoApi.cloudAvailable(function(){ - newFileSettings.callback = this.createNewFile.bind(this); - this.application.ninja.newFileController.showNewFileDialog(newFileSettings); - }.bind(this)); - + newFileSettings.callback = this.createNewFile.bind(this); + this.application.ninja.newFileController.showNewFileDialog(newFileSettings); } }, -- cgit v1.2.3 From b1daf0b285a4a96bfd0086709c20e3682d75551a Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 14:32:17 -0800 Subject: fixing the dirty flag and removing sass changes Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'js/controllers/document-controller.js') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 9a063280..e0402219 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -131,20 +131,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component, fileSaveResult: { value: function (result) { if(result.status === 204){ - this.clearDocumentDirtyFlag(); + this.activeDocument.needsSave = false; } } }, - //////////////////////////////////////////////////////////////////// - - - clearDocumentDirtyFlag:{ - value: function(){ - this.activeDocument.dirtyFlag = false; - } - }, - - + createNewFile:{ value:function(newFileObj){ //console.log(newFileObj);//contains the template uri and the new file uri @@ -282,7 +273,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, closeDocument: { value: function(id) { - if(this.activeDocument.dirtyFlag === true){ + if(this.activeDocument.needsSave === true){ //if file dirty then alert user to save } -- cgit v1.2.3