aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/styles-view-container.reel
diff options
context:
space:
mode:
authorEric Guzman2012-05-14 23:44:47 -0700
committerEric Guzman2012-05-14 23:44:47 -0700
commitd4ce8c2fe42fcbfc36cf4b20ef8de67c6471c241 (patch)
tree9698ed4cc633fc6ac84250ee2f342b5d3a6f8d97 /js/panels/css-panel/styles-view-container.reel
parentb3624fbd6ed9c03e1b5c889bf4757af2ff6ce96d (diff)
downloadninja-d4ce8c2fe42fcbfc36cf4b20ef8de67c6471c241.tar.gz
CSSPanel - Add mutli-selection and adding classes to groups of elements
Diffstat (limited to 'js/panels/css-panel/styles-view-container.reel')
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.js34
1 files changed, 30 insertions, 4 deletions
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 a47b0db1..1372de0c 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
@@ -14,6 +14,21 @@ exports.StylesViewContainer = Montage.create(Component, {
14 contentPanel : { 14 contentPanel : {
15 value: 'rules' 15 value: 'rules'
16 }, 16 },
17 _selectionNameLabelText : {
18 value: null
19 },
20 selectionNameLabelText : {
21 get: function() {
22 return this._selectionNameLabelText;
23 },
24 set: function(value) {
25 if(value === this._selectionNameLabelText) { return false; }
26
27 this._selectionNameLabelText = value;
28
29 this.needsDraw = true;
30 }
31 },
17 _lastSelection : { 32 _lastSelection : {
18 value: null 33 value: null
19 }, 34 },
@@ -62,7 +77,10 @@ exports.StylesViewContainer = Montage.create(Component, {
62 value: function() { 77 value: function() {
63 var elements = this.application.ninja.selectedElements; 78 var elements = this.application.ninja.selectedElements;
64 79
65 if(this._isSameArray(elements, this._lastSelection)) { console.log('new selection is identical');return false; } 80 if(this._isSameArray(elements, this._lastSelection) && this.contentPanel === "rules") {
81 console.log('new selection is identical');
82 return false;
83 }
66 84
67 this._lastSelection = elements; 85 this._lastSelection = elements;
68 86
@@ -72,14 +90,20 @@ exports.StylesViewContainer = Montage.create(Component, {
72 } else if(elements.length === 1) { 90 } else if(elements.length === 1) {
73 91
74 ///// update the selection status label with the label of the element 92 ///// update the selection status label with the label of the element
75 this.selectionNameLabel.innerHTML = this._getElementLabel(elements[0]); 93 this.selectionNameLabelText = this._getElementLabel(elements[0]);
76 94
77 if(this.contentPanel === "rules") { 95 if(this.contentPanel === "rules") {
78 this.ruleListContainer.displayListForSelection(elements); 96 this.ruleListContainer.displayListForSelection(elements);
79 } else { 97 } else {
80 this.computedStyleView.declaration = elements[0]; 98 this.computedStyleView.declaration = elements[0];
81 } 99 }
100 this.toolbar.showButton('computed');
82 } else { 101 } else {
102 this.toolbar.hideButton('computed');
103 this.contentPanel = "rules";
104 this.selectionNameLabelText = elements.length + " elements selected.";
105 ///// find common rules
106 this.ruleListContainer.displayListForSelection(elements);
83 107
84 } 108 }
85 109
@@ -130,10 +154,12 @@ exports.StylesViewContainer = Montage.create(Component, {
130 value: function() { 154 value: function() {
131 if(this.hasStyles) { 155 if(this.hasStyles) {
132 this.element.classList.remove('no-styles'); 156 this.element.classList.remove('no-styles');
133 this.selectionNameLabel.classList.remove('no-styles'); 157 //this.selectionNameLabel.classList.remove('no-styles');
158 this.selectionName.element.classList.remove('no-styles');
134 } else { 159 } else {
135 this.element.classList.add('no-styles'); 160 this.element.classList.add('no-styles');
136 this.selectionNameLabel.classList.add('no-styles'); 161 //this.selectionNameLabel.classList.add('no-styles');
162 this.selectionName.element.classList.add('no-styles');
137 } 163 }
138 } 164 }
139 }, 165 },