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') 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 f9d34a54baf61ccdf77732b1aaedb29d296b8c2e Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 20 Feb 2012 23:03:48 -0800 Subject: enabling nested selection Signed-off-by: Valerio Virgillito --- js/controllers/elements/element-controller.js | 3 +++ js/controllers/selection-controller.js | 37 ++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 6 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 65d26bdd..ac14def4 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -12,6 +12,9 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, addElement: { value: function(el, styles) { this.application.ninja.currentDocument.documentRoot.appendChild(el); + // Nested elements - + // TODO make sure the CSS is correct before nesting elements + // this.application.ninja.currentSelectedContainer.appendChild(el); this.application.ninja.stylesController.setElementStyles(el, styles); } }, diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 833e6f04..fed9affd 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -20,6 +20,27 @@ exports.SelectionController = Montage.create(Component, { } }, + /* + * Bound property to the ninja currentSelectedContainer + */ + _selectionContainer: { + value: null + }, + + selectionContainer: { + get: function() { + return this._selectionContainer + }, + set: function(value) { + if(this._selectionContainer && this._selectionContainer !== value) { + console.log("setting container in the selection tool"); + this.executeSelectElement(); + } + + this._selectionContainer = value; + } + }, + deserializedFromTemplate: { value: function() { this.eventManager.addEventListener("openDocument", this, false); @@ -53,7 +74,9 @@ exports.SelectionController = Montage.create(Component, { } } - this.dispatchEvent(selectionEvent.event); + // + this._selectionContainer = this.application.ninja.currentSelectedContainer; + } }, @@ -66,13 +89,10 @@ exports.SelectionController = Montage.create(Component, { handleElementDeleted: { value: function(event) { if(!this._isDocument) { - if(this.findSelectedElement(event.detail) !== -1) { this.executeSelectElement(); } - } - } }, @@ -130,12 +150,17 @@ exports.SelectionController = Montage.create(Component, { this.executeSelectElement(); // Else execute selection with no item } else { - if(item.parentNode.id == "UserContent") { +// if(item.parentNode.id === "UserContent") { + if(item.parentNode.uuid === this.selectionContainer.uuid) { this.executeSelectElement(item); } else { var outerElement = item.parentNode; - while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { + while(outerElement.parentNode && outerElement.parentNode.uuid !== this.selectionContainer.uuid) { + //while(outerElement.parentNode && outerElement.parentNode.id !== "UserContent") { + // If element is higher up than current container then return + if(outerElement.id === "UserContent") return; + // else keep going up the chain outerElement = outerElement.parentNode; } -- 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') 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 From 2f24dafec79583547fe663d5a387d8ef15aae3bf Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 21 Feb 2012 17:33:11 -0800 Subject: user document main reel listener moved to the html-document class. Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index fed9affd..d69b53e0 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -33,7 +33,6 @@ exports.SelectionController = Montage.create(Component, { }, set: function(value) { if(this._selectionContainer && this._selectionContainer !== value) { - console.log("setting container in the selection tool"); this.executeSelectElement(); } -- cgit v1.2.3