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/bread-crumb.reel/bread-crumb.js | 16 +++------------- js/components/layout/document-bar.reel/document-bar.js | 15 --------------- .../layout/document-entry.reel/document-entry.js | 11 +---------- 3 files changed, 4 insertions(+), 38 deletions(-) (limited to 'js/components') diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index 74e89ac1..ac131f2c 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js @@ -26,12 +26,12 @@ exports.Breadcrumb = Montage.create(Component, { this._currentDocument = value; - if(!this._currentDocument) { + if(!value) { this.disabled = true; + } else { + this.disabled = this._currentDocument.currentView !== "design"; } - this.disabled = this._currentDocument.currentView !== "design"; - } }, @@ -51,15 +51,6 @@ exports.Breadcrumb = Montage.create(Component, { } }, - handleCloseDocument: { - value: function(){ - if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { - this.disabled = true; - this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null); - } - } - }, - _container:{ value:null }, @@ -82,7 +73,6 @@ exports.Breadcrumb = Montage.create(Component, { prepareForDraw: { value: function() { - this.eventManager.addEventListener("closeDocument", this, false); this.breadcrumbBt.addEventListener("action", this, false); } }, diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 6a7b0f3f..90d3a207 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -105,7 +105,6 @@ exports.DocumentBar = Montage.create(Component, { prepareForDraw: { value: function() { - this.eventManager.addEventListener( "closeDocument", this, false); this.designView.addEventListener("click", this, false); this.codeView.addEventListener("click", this, false); @@ -135,19 +134,5 @@ exports.DocumentBar = Montage.create(Component, { this.currentView = event._event.target.id; this.application.ninja.documentController.stage.stageView.switchDesignDocViews(event._event.target.id);//switch between design view } - }, - - handleCloseDocument: { - value: function() { - if(!this.application.ninja.documentController.activeDocument) { - this.disabled = true; - } - } - }, - - handleOnDocumentChanged:{ - value:function(event){ - - } } }); 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