From d5b36812ba84e49aa8b597eea9f75bf36ddcb571 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 23 May 2012 15:24:25 -0700 Subject: fixing the styles manager to open code view files and closing the last document. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 15 ++++++--------- js/controllers/styles-controller.js | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 3e15511d..aa037bd4 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -399,10 +399,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, if(this._documents.length > 0) { previousFocusedDocument = this._documents[this._documents.length - 1]; - this._activeDocument = previousFocusedDocument; - this.switchDocuments(this.activeDocument, previousFocusedDocument, true); + this.activeDocument = previousFocusedDocument; + this.switchDocuments(this.activeDocument, previousFocusedDocument, false); } else { - this._activeDocument = null; + this.activeDocument = null; this.application.ninja.stage.hideRulers(); this.application.ninja.stage.hideCanvas(true); @@ -524,13 +524,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.application.ninja.stage.restoreAllPanels(); this.application.ninja.stage.hideCanvas(false); this.application.ninja.stage.showRulers(); - } else if(currentDocument.currentView === "design" && newDocument.currentView === "code") { - this.application.ninja.stage.showCodeViewBar(true); - this.application.ninja.stage.collapseAllPanels(); - this.application.ninja.stage.hideCanvas(true); - this.application.ninja.stage.hideRulers(); } - }else if(!currentDocument && newDocument.currentView === "code"){ + } + + if(newDocument.currentView === "code") { this.application.ninja.stage.showCodeViewBar(true); this.application.ninja.stage.collapseAllPanels(); this.application.ninja.stage.hideCanvas(true); diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index dcbe0eaf..8ceb9774 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -81,7 +81,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { set : function(document) { ///// If the document is null set default stylesheets to null - if(!document) { + if(!document || document.currentView === "code") { this._activeDocument = null; this._stageStylesheet = null; this.defaultStylesheet = null; -- cgit v1.2.3