aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-04 11:03:11 -0700
committerJose Antonio Marquez2012-06-04 11:03:11 -0700
commitb6c6c194d4768cf03adee55e8ebe53428cbea2a1 (patch)
treeaaeb5301d1361a1d3a681ebd5c01dd618a712c2e /js/panels/css-panel
parentf02b6c98b193cc4cb7755a098b548efddf15c1bb (diff)
parentc1ec69879028220b0c3f11ad6e24035bf527802c (diff)
downloadninja-b6c6c194d4768cf03adee55e8ebe53428cbea2a1.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Components
Diffstat (limited to 'js/panels/css-panel')
-rw-r--r--js/panels/css-panel/css-panel.reel/css-panel.html3
-rw-r--r--js/panels/css-panel/css-panel.reel/css-panel.js18
-rw-r--r--js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js8
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.js31
-rw-r--r--js/panels/css-panel/styles-view-delegate.js2
5 files changed, 49 insertions, 13 deletions
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
31 "properties": { 31 "properties": {
32 "element": {"#": "styles-view-container" }, 32 "element": {"#": "styles-view-container" },
33 "selectionName": {"@": "selectionName" } 33 "selectionName": {"@": "selectionName" }
34 },
35 "bindings": {
36 "currentDocument" : {"<-": "@owner.currentDocument" }
34 } 37 }
35 }, 38 },
36 "selectionName" : { 39 "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,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10exports.CssPanel = Montage.create(Component, { 10exports.CssPanel = Montage.create(Component, {
11
12 _currentDocument: {
13 value : null
14 },
15
16 currentDocument : {
17 get : function() {
18 return this._currentDocument;
19 },
20 set : function(value) {
21 if (value === this._currentDocument) {
22 return;
23 }
24
25 this._currentDocument = value;
26 }
27 },
28
11 prepareForDraw : { 29 prepareForDraw : {
12 value: function() { 30 value: function() {
13 } 31 }
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, {
63 if(this.styleSheetList) { 63 if(this.styleSheetList) {
64 sheetComponent = this.styleSheetList.childComponents[this.styleSheets.indexOf(sheet)]; 64 sheetComponent = this.styleSheetList.childComponents[this.styleSheets.indexOf(sheet)];
65 if(sheetComponent) { 65 if(sheetComponent) {
66 sheetComponent.default = true; 66 sheetComponent['default'] = true;
67 if(this._defaultStyleSheet) { 67 if(this._defaultStyleSheet) {
68 oldDefaultSheet = this.styleSheetList.childComponents[this.styleSheets.indexOf(this._defaultStyleSheet)]; 68 oldDefaultSheet = this.styleSheetList.childComponents[this.styleSheets.indexOf(this._defaultStyleSheet)];
69 oldDefaultSheet.default = false; 69 oldDefaultSheet['default'] = false;
70 } 70 }
71 } 71 }
72 } 72 }
@@ -115,12 +115,12 @@ exports.StyleSheetsView = Montage.create(Component, {
115 115
116 handleStyleSheetsReady : { 116 handleStyleSheetsReady : {
117 value: function(e) { 117 value: function(e) {
118 this.documentName = this.stylesController.activeDocument.name; 118 this.documentName = this.stylesController.currentDocument.name;
119 this.styleSheets = this.stylesController.userStyleSheets; 119 this.styleSheets = this.stylesController.userStyleSheets;
120 120
121 Object.defineBinding(this, 'activeDocument', { 121 Object.defineBinding(this, 'activeDocument', {
122 'boundObject': this.stylesController, 122 'boundObject': this.stylesController,
123 'boundObjectPropertyPath': 'activeDocument', 123 'boundObjectPropertyPath': 'currentDocument',
124 'oneway': true 124 'oneway': true
125 }); 125 });
126 126
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,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10exports.StylesViewContainer = Montage.create(Component, { 10exports.StylesViewContainer = Montage.create(Component, {
11
12 _currentDocument: {
13 value : null
14 },
15
16 currentDocument : {
17 get : function() {
18 return this._currentDocument;
19 },
20 set : function(value) {
21 if (value === this._currentDocument) {
22 return;
23 }
24
25 this._currentDocument = value;
26
27 if(!value) {
28 this.hasStyles = false;
29 this.needsDraw = true;
30 }
31 }
32 },
33
11 contentController : { 34 contentController : {
12 value: null 35 value: null
13 }, 36 },
@@ -74,7 +97,6 @@ exports.StylesViewContainer = Montage.create(Component, {
74 value: function() { 97 value: function() {
75 this.eventManager.addEventListener('styleSheetsReady', this, false); 98 this.eventManager.addEventListener('styleSheetsReady', this, false);
76 this.eventManager.addEventListener('elementChange', this, false); 99 this.eventManager.addEventListener('elementChange', this, false);
77 this.eventManager.addEventListener("closeDocument", this, false);
78 } 100 }
79 }, 101 },
80 handleStyleSheetsReady: { 102 handleStyleSheetsReady: {
@@ -150,13 +172,6 @@ exports.StylesViewContainer = Montage.create(Component, {
150 } 172 }
151 }, 173 },
152 174
153 handleCloseDocument: {
154 value: function(e) {
155 this.hasStyles = false;
156 this.needsDraw = true;
157 }
158 },
159
160 draw : { 175 draw : {
161 value: function() { 176 value: function() {
162 if(this.hasStyles) { 177 if(this.hasStyles) {
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, {
30 value: function(selector, direction) { 30 value: function(selector, direction) {
31 if(!selector) { return false; } 31 if(!selector) { return false; }
32 32
33 var elements = this.stylesController._activeDocument.model.views.design.document.querySelectorAll(selector), 33 var elements = this.stylesController.currentDocument.model.views.design.document.querySelectorAll(selector),
34 method = (direction === "out") ? "remove" : "add"; 34 method = (direction === "out") ? "remove" : "add";
35 35
36 Array.prototype.slice.call(elements).forEach(function(el) { 36 Array.prototype.slice.call(elements).forEach(function(el) {