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 --- js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/panels/css-panel') 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 5081a124..9e3b4a49 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 @@ -63,10 +63,10 @@ exports.StyleSheetsView = Montage.create(Component, { if(this.styleSheetList) { sheetComponent = this.styleSheetList.childComponents[this.styleSheets.indexOf(sheet)]; if(sheetComponent) { - sheetComponent.default = true; + sheetComponent['default'] = true; if(this._defaultStyleSheet) { oldDefaultSheet = this.styleSheetList.childComponents[this.styleSheets.indexOf(this._defaultStyleSheet)]; - oldDefaultSheet.default = false; + oldDefaultSheet['default'] = false; } } } @@ -115,12 +115,12 @@ exports.StyleSheetsView = Montage.create(Component, { handleStyleSheetsReady : { value: function(e) { - this.documentName = this.stylesController.activeDocument.name; + this.documentName = this.stylesController.currentDocument.name; this.styleSheets = this.stylesController.userStyleSheets; Object.defineBinding(this, 'activeDocument', { 'boundObject': this.stylesController, - 'boundObjectPropertyPath': 'activeDocument', + 'boundObjectPropertyPath': 'currentDocument', 'oneway': true }); -- 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/panels/css-panel/css-panel.reel/css-panel.html | 3 +++ js/panels/css-panel/css-panel.reel/css-panel.js | 18 +++++++++++++ .../styles-view-container.js | 31 ++++++++++++++++------ 3 files changed, 44 insertions(+), 8 deletions(-) (limited to 'js/panels/css-panel') diff --git a/js/panels/css-panel/css-panel.reel/css-panel.html b/js/panels/css-panel/css-panel.reel/css-panel.html index 42dca8a2..789635a0 100644 --- a/js/panels/css-panel/css-panel.reel/css-panel.html +++ b/js/panels/css-panel/css-panel.reel/css-panel.html @@ -31,6 +31,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "properties": { "element": {"#": "styles-view-container" }, "selectionName": {"@": "selectionName" } + }, + "bindings": { + "currentDocument" : {"<-": "@owner.currentDocument" } } }, "selectionName" : { diff --git a/js/panels/css-panel/css-panel.reel/css-panel.js b/js/panels/css-panel/css-panel.reel/css-panel.js index a117787e..96d94b36 100644 --- a/js/panels/css-panel/css-panel.reel/css-panel.js +++ b/js/panels/css-panel/css-panel.reel/css-panel.js @@ -8,6 +8,24 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; exports.CssPanel = Montage.create(Component, { + + _currentDocument: { + value : null + }, + + currentDocument : { + get : function() { + return this._currentDocument; + }, + set : function(value) { + if (value === this._currentDocument) { + return; + } + + this._currentDocument = value; + } + }, + prepareForDraw : { value: function() { } diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js index 4a391421..157d99de 100644 --- a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js +++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js @@ -8,6 +8,29 @@ var Montage = require("montage/core/core").Montage, Component = require("montage/ui/component").Component; exports.StylesViewContainer = Montage.create(Component, { + + _currentDocument: { + value : null + }, + + currentDocument : { + get : function() { + return this._currentDocument; + }, + set : function(value) { + if (value === this._currentDocument) { + return; + } + + this._currentDocument = value; + + if(!value) { + this.hasStyles = false; + this.needsDraw = true; + } + } + }, + contentController : { value: null }, @@ -74,7 +97,6 @@ exports.StylesViewContainer = Montage.create(Component, { value: function() { this.eventManager.addEventListener('styleSheetsReady', this, false); this.eventManager.addEventListener('elementChange', this, false); - this.eventManager.addEventListener("closeDocument", this, false); } }, handleStyleSheetsReady: { @@ -150,13 +172,6 @@ exports.StylesViewContainer = Montage.create(Component, { } }, - handleCloseDocument: { - value: function(e) { - this.hasStyles = false; - this.needsDraw = true; - } - }, - draw : { value: function() { if(this.hasStyles) { -- cgit v1.2.3 From 266460e52831c5b3a3473be420756fd88bb8aced Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 1 Jun 2012 16:24:14 -0700 Subject: fix for the css panel Signed-off-by: Valerio Virgillito --- js/panels/css-panel/styles-view-delegate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/panels/css-panel') diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js index 078bd521..87686826 100644 --- a/js/panels/css-panel/styles-view-delegate.js +++ b/js/panels/css-panel/styles-view-delegate.js @@ -30,7 +30,7 @@ exports.StylesViewDelegate = Montage.create(Component, { value: function(selector, direction) { if(!selector) { return false; } - var elements = this.stylesController._activeDocument.model.views.design.document.querySelectorAll(selector), + var elements = this.stylesController.currentDocument.model.views.design.document.querySelectorAll(selector), method = (direction === "out") ? "remove" : "add"; Array.prototype.slice.call(elements).forEach(function(el) { -- cgit v1.2.3