From a8e97144c832e355de7f8177ce38644119248e87 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 21 May 2012 09:30:24 -0700 Subject: Style sheets view - Fixed drawing of toolbar and "no sheets" message --- js/components/toolbar.reel/toolbar.html | 8 +++----- js/components/toolbar.reel/toolbar.js | 2 +- .../style-sheets-view.reel/style-sheets-view.html | 16 ++++++++------- .../style-sheets-view.reel/style-sheets-view.js | 24 +++++++++++++++++++++- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/js/components/toolbar.reel/toolbar.html b/js/components/toolbar.reel/toolbar.html index 53c6627a..b33c4665 100644 --- a/js/components/toolbar.reel/toolbar.html +++ b/js/components/toolbar.reel/toolbar.html @@ -11,8 +11,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot -
+
diff --git a/js/components/toolbar.reel/toolbar.js b/js/components/toolbar.reel/toolbar.js index bc3cbd08..8f93aa2b 100644 --- a/js/components/toolbar.reel/toolbar.js +++ b/js/components/toolbar.reel/toolbar.js @@ -20,7 +20,7 @@ exports.Toolbar = Montage.create(Component, { }, set: function(btns) { this._buttons = btns; - this._needsButtonProperties = true; + this._needsButtonProperties = this.needsDraw = true;; } }, diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html index bbefc69b..3e15f50b 100644 --- a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html +++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html @@ -14,6 +14,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "prototype" : "js/panels/css-panel/style-sheets-view.reel", "properties" : { "element" : {"#" : "style-sheets-view-container"}, + "toolbar" : {"@": "toolbar"}, "styleSheetList" : {"@" : "styleSheetList"} } }, @@ -47,29 +48,30 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot } } }, - "noDocumentCondition": { + "documentLoaded": { "prototype": "montage/ui/condition.reel", "properties": { - "element": {"#": "no-document-message" } + "element": {"#": "style-sheets-toolbar-container" }, + "removalStrategy": "hide" }, "bindings": { "condition": { "boundObject": {"@": "owner" }, - "boundObjectPropertyPath": "styleSheets.count()", - "boundValueMutator": {"->": {"arguments": ["val"], "body": "return !val;"}}, + "boundObjectPropertyPath": "documentLoaded", "oneway": true } } }, - "showToolbarCondition": { + "hasSheets": { "prototype": "montage/ui/condition.reel", "properties": { - "element": {"#": "style-sheets-toolbar-container" } + "element": {"#": "no-sheets-message" } }, "bindings" : { "condition": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "styleSheets.count()", + "boundValueMutator": {"->": {"arguments": ["val"], "body": "return !val;"}}, "oneway": true } } @@ -113,7 +115,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
-

No style sheets to display.

+

No style sheets to display.

diff --git a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js index d6ec5349..28b094a7 100644 --- a/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js +++ b/js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js @@ -8,7 +8,7 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; exports.StyleSheetsView = Montage.create(Component, { - noDocumentCondition : { value: true }, + documentLoaded : { value: false }, showToolbar : { value: false }, stylesController : { value: null }, styleSheets : { value: [] }, @@ -17,6 +17,22 @@ exports.StyleSheetsView = Montage.create(Component, { documentNameLabel : { value: null }, noDocumentLabelClass : { value: "no-document" }, + _activeDocument: { + value: null + }, + activeDocument : { + get: function() { + return this._activeDocument; + }, + set: function(value) { + if(value === this._activeDocument) { return;} + + this.documentLoaded = !!value; + + this._activeDocument = value; + } + }, + _documentName : { value: null }, documentName : { get: function() { @@ -99,6 +115,12 @@ exports.StyleSheetsView = Montage.create(Component, { this.documentName = this.stylesController.activeDocument.name; this.styleSheets = this.stylesController.userStyleSheets; + Object.defineBinding(this, 'activeDocument', { + 'boundObject': this.stylesController, + 'boundObjectPropertyPath': 'activeDocument', + 'oneway': true + }); + Object.defineBinding(this, 'defaultStyleSheet', { 'boundObject': this.stylesController, 'boundObjectPropertyPath': 'defaultStylesheet', -- cgit v1.2.3