From 6079ceedb5b340c78ecd02f27dfa734eedccf512 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 00:39:14 -0700 Subject: making the document bar handle the current document to hide/show itself Signed-off-by: Valerio Virgillito --- .../layout/document-bar.reel/document-bar.js | 55 +++++++++++++++++++--- 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'js/components/layout/document-bar.reel') diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js index 90d3a207..1cb0bd90 100755 --- a/js/components/layout/document-bar.reel/document-bar.js +++ b/js/components/layout/document-bar.reel/document-bar.js @@ -28,13 +28,45 @@ exports.DocumentBar = Montage.create(Component, { this.disabled = !this._currentDocument; + if(this._currentDocument && this._currentDocument.currentView === "design") { + this.visible = true; + } else if(this._currentDocument && this._currentDocument.currentView === "code") { + this.visible = false; + } } }, - designView: { value: null, enumerable: false}, - codeView: { value: null, enumerable: false}, - zoomControl: { value: null, enumerable: false }, - _type: { enumerable: false, value: null }, + _visible: { + value: false + }, + + visible: { + get: function() { + return this._visible; + }, + set: function(value) { + if(this._visible !== value) { + this._visible = value; + this.needsDraw = true; + } + } + }, + + designView: { + value: null + }, + + codeView: { + value: null + }, + + zoomControl: { + value: null + }, + + _type: { + value: null + }, type: { enumerable: false, @@ -50,7 +82,9 @@ exports.DocumentBar = Montage.create(Component, { } }, - _currentView: { value: null, enumerable: false }, + _currentView: { + value: null + }, currentView: { get: function() { return this._currentView}, @@ -64,7 +98,9 @@ exports.DocumentBar = Montage.create(Component, { } }, - _zoomFactor: { value: 100, enumerable: false }, + _zoomFactor: { + value: 100 + }, zoomFactor: { get: function() { return this._zoomFactor; }, @@ -84,6 +120,7 @@ exports.DocumentBar = Montage.create(Component, { draw: { value: function() { + /* if(this.type === "htm" || this.type === "html") { this.designView.classList.add("active"); this.codeView.classList.add("active"); @@ -99,6 +136,12 @@ exports.DocumentBar = Montage.create(Component, { } else if(this.type) { this.designView.classList.remove("active"); } + */ + if(this.visible) { + this.element.style.display = "block"; + } else { + this.element.style.display = "none"; + } } }, -- cgit v1.2.3