From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- .../layout/document-entry.reel/document-entry.js | 44 ++++++++-------------- 1 file changed, 15 insertions(+), 29 deletions(-) (limited to 'js/components/layout/document-entry.reel/document-entry.js') diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 50b3624c..2e66c7cd 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -58,25 +58,6 @@ exports.DocumentEntry = Montage.create(Component, { } }, - _active: { - enumerable: false, - value: null - }, - - active: { - get: function() { - return this._active; - }, - set: function(value) { - var previousValue = this._active; - this._active = value; - - if (previousValue !== this._active) { - this.needsDraw = true; - } - } - }, - _saveFlag: { value: false }, @@ -96,7 +77,8 @@ exports.DocumentEntry = Montage.create(Component, { prepareForDraw: { enumerable: false, value: function() { - this.element.addEventListener("click", this, false); +// this.element.addEventListener("click", this, false); +// this.closeBtn.addEventListener("click", this, true); } }, @@ -106,7 +88,7 @@ exports.DocumentEntry = Montage.create(Component, { value: function() { this.label.innerText = this._name ? this._name : ""; - this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); +// this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); if(this.saveFlag) { this.label.classList.add("dirty"); @@ -116,15 +98,19 @@ exports.DocumentEntry = Montage.create(Component, { } }, - handleClick: { + captureClick: { value: function(event) { - if(event._event.target.nodeName === "IMG") { - this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); - } else { - if(!this.active) { - this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); - } - } + console.log("clicked on the X"); + event.preventDefault(); + event.stopImmediatePropagation(); + event.stopPropagation(); +// if(event._event.target.nodeName === "IMG") { +// this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); +// } else { +// if(!this.active) { +// this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); +// } +// } } } -- cgit v1.2.3 From 4fa08fe2ce439a5f5c248c568f72d3828ee11b36 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 11:43:55 -0700 Subject: fix for the document tab close button and rulers on initial document Signed-off-by: Valerio Virgillito --- .../layout/document-entry.reel/document-entry.js | 37 ++++------------------ 1 file changed, 7 insertions(+), 30 deletions(-) (limited to 'js/components/layout/document-entry.reel/document-entry.js') diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 2e66c7cd..34e307cb 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -9,15 +9,11 @@ var Component = require("montage/ui/component").Component; exports.DocumentEntry = Montage.create(Component, { - dirty: { value: null }, - _uuid: { - value: null, - enumerable: false + value: null }, _document: { - enumerable: false, value: null }, @@ -40,7 +36,9 @@ exports.DocumentEntry = Montage.create(Component, { } }, - _name: { value: null }, + _name: { + value: null + }, name: { enumerable: false, @@ -74,22 +72,11 @@ exports.DocumentEntry = Montage.create(Component, { } }, - prepareForDraw: { - enumerable: false, - value: function() { -// this.element.addEventListener("click", this, false); -// this.closeBtn.addEventListener("click", this, true); - } - }, - - draw: { enumerable: false, value: function() { this.label.innerText = this._name ? this._name : ""; -// this._active ? this.element.classList.add("activeTab") : this.element.classList.remove("activeTab"); - if(this.saveFlag) { this.label.classList.add("dirty"); } else { @@ -98,19 +85,9 @@ exports.DocumentEntry = Montage.create(Component, { } }, - captureClick: { - value: function(event) { - console.log("clicked on the X"); - event.preventDefault(); - event.stopImmediatePropagation(); - event.stopPropagation(); -// if(event._event.target.nodeName === "IMG") { -// this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); -// } else { -// if(!this.active) { -// this.application.ninja.documentController.switchDocuments(this.application.ninja.currentDocument, this.application.ninja.documentController._findDocumentByUUID(this._uuid)); -// } -// } + handleCloseButtonAction: { + value: function() { + //this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); } } -- cgit v1.2.3 From 31b094ee21102f99a4021d505bc3a28527c9e23d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 30 May 2012 01:33:20 -0700 Subject: Fixing the close document. Signed-off-by: Valerio Virgillito --- js/components/layout/document-entry.reel/document-entry.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'js/components/layout/document-entry.reel/document-entry.js') diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js index 34e307cb..94056007 100755 --- a/js/components/layout/document-entry.reel/document-entry.js +++ b/js/components/layout/document-entry.reel/document-entry.js @@ -9,10 +9,6 @@ var Component = require("montage/ui/component").Component; exports.DocumentEntry = Montage.create(Component, { - _uuid: { - value: null - }, - _document: { value: null }, @@ -23,16 +19,11 @@ exports.DocumentEntry = Montage.create(Component, { return this._document; }, set: function(value) { - if (this._document === value) { return; } this._document = value; - - if(value) { - this._uuid = value.uuid; - } } }, @@ -87,7 +78,7 @@ exports.DocumentEntry = Montage.create(Component, { handleCloseButtonAction: { value: function() { - //this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); + this.application.ninja.documentController.closeFile(this.document); } } -- cgit v1.2.3