aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel
diff options
context:
space:
mode:
authorEric Guzman2012-05-18 14:05:06 -0700
committerEric Guzman2012-05-18 14:05:06 -0700
commit197a7646e472fcea616764685c8d03c6063e66f5 (patch)
tree793ef1007234f15958127b3c6f2fb3ff7b7a598b /js/panels/css-panel
parent18c260f5f55608d4774aea27f6c2d23e89921361 (diff)
downloadninja-197a7646e472fcea616764685c8d03c6063e66f5.tar.gz
CSS Panel - Add support for deleting style sheets
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-style.reel/css-style.js13
-rw-r--r--js/panels/css-panel/style-sheet.reel/style-sheet.html16
-rw-r--r--js/panels/css-panel/style-sheet.reel/style-sheet.js21
-rw-r--r--js/panels/css-panel/style-sheets-view.reel/style-sheets-view.html24
-rw-r--r--js/panels/css-panel/style-sheets-view.reel/style-sheets-view.js25
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.html1
7 files changed, 46 insertions, 57 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 5bc5c87d..54bb1fae 100644
--- a/js/panels/css-panel/css-panel.reel/css-panel.html
+++ b/js/panels/css-panel/css-panel.reel/css-panel.html
@@ -15,7 +15,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
15 "name" : "CSSPanelNew", 15 "name" : "CSSPanelNew",
16 "properties" : { 16 "properties" : {
17 "element" : {"#" : "container"}, 17 "element" : {"#" : "container"},
18 "styleSheetsView": {"@": "styleSheetsView"} 18 "styleSheetsView": {"@": "styleSheetsView"},
19 "stylesViewContainer": {"@": "stylesViewContainer"}
19 } 20 }
20 }, 21 },
21 22
diff --git a/js/panels/css-panel/css-style.reel/css-style.js b/js/panels/css-panel/css-style.reel/css-style.js
index 3a07f8f1..1787665f 100644
--- a/js/panels/css-panel/css-style.reel/css-style.js
+++ b/js/panels/css-panel/css-style.reel/css-style.js
@@ -143,17 +143,8 @@ exports.CssStyle = Montage.create(Component, {
143 143
144 getRule : { 144 getRule : {
145 value: function() { 145 value: function() {
146 //var declarationComponent = this.treeView.parentComponent, 146 var declarationComponent = this.parentComponent.parentComponent.parentComponent
147 var declarationComponent = this.parentComponent.parentComponent.parentComponent, 147 return declarationComponent.rule;
148 rule;
149
150 if(declarationComponent.type === 'inline') {
151 rule = { style : declarationComponent.declaration }
152 } else {
153 rule = this.parentComponent.parentComponent.parentComponent.declaration.parentRule;
154 }
155
156 return rule;
157 } 148 }
158 }, 149 },
159 150
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.html b/js/panels/css-panel/style-sheet.reel/style-sheet.html
index ca24487d..788cafcc 100644
--- a/js/panels/css-panel/style-sheet.reel/style-sheet.html
+++ b/js/panels/css-panel/style-sheet.reel/style-sheet.html
@@ -20,7 +20,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
20 "editButton": {"@": "editButton"}, 20 "editButton": {"@": "editButton"},
21 "editView": {"#": "style-sheet-edit"}, 21 "editView": {"#": "style-sheet-edit"},
22 "disableButton": {"@": "disableButton"}, 22 "disableButton": {"@": "disableButton"},
23 "importButton": {"@": "importButton"},
24 "deleteButton": {"@": "deleteButton"} 23 "deleteButton": {"@": "deleteButton"}
25 } 24 }
26 }, 25 },
@@ -75,20 +74,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
75 }] 74 }]
76 75
77 }, 76 },
78 "importButton": {
79 "module": "montage/ui/button.reel",
80 "name": "Button",
81 "properties": {
82 "element": {"#": "import-button"},
83 "identifier": "importButton",
84 "label": "Import"
85 },
86 "listeners": [{
87 "type": "action",
88 "listener": {"@": "owner"}
89 }]
90
91 },
92 "deleteButton": { 77 "deleteButton": {
93 "module": "montage/ui/button.reel", 78 "module": "montage/ui/button.reel",
94 "name": "Button", 79 "name": "Button",
@@ -118,7 +103,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
118 103
119 <button data-montage-id="edit-button" class="ss-edit-button"></button> 104 <button data-montage-id="edit-button" class="ss-edit-button"></button>
120 <button data-montage-id="delete-button" class="ss-delete-button nj-skinned"></button> 105 <button data-montage-id="delete-button" class="ss-delete-button nj-skinned"></button>
121 <button data-montage-id="import-button" class="ss-import-button nj-skinned"></button>
122 <button data-montage-id="disable-button" class="ss-disable-button nj-skinned"></button> 106 <button data-montage-id="disable-button" class="ss-disable-button nj-skinned"></button>
123 107
124 </div> 108 </div>
diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.js b/js/panels/css-panel/style-sheet.reel/style-sheet.js
index 0ff195d5..a3326275 100644
--- a/js/panels/css-panel/style-sheet.reel/style-sheet.js
+++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js
@@ -11,6 +11,10 @@ exports.StyleSheet = Montage.create(Component, {
11 _translateDistance: { 11 _translateDistance: {
12 value: null 12 value: null
13 }, 13 },
14 viewContainer : {
15 value: null,
16 serializable: true
17 },
14 18
15 prepareForDraw : { 19 prepareForDraw : {
16 value: function() { 20 value: function() {
@@ -43,14 +47,6 @@ exports.StyleSheet = Montage.create(Component, {
43 this.editView.style.removeProperty(transStr); 47 this.editView.style.removeProperty(transStr);
44 } 48 }
45 49
46 if(this._readOnly) {
47 this._element.classList.add('ss-locked');
48 this.importButton.element.classList.remove('ss-invisible');
49 } else {
50 this._element.classList.remove('ss-locked');
51 this.importButton.element.classList.add('ss-invisible');
52 }
53
54 if(this.default) { 50 if(this.default) {
55 this._element.classList.add('default-style-sheet'); 51 this._element.classList.add('default-style-sheet');
56 } else { 52 } else {
@@ -73,10 +69,7 @@ exports.StyleSheet = Montage.create(Component, {
73 var nonBlurringElements = [ 69 var nonBlurringElements = [
74 this.editView, 70 this.editView,
75 this.deleteButton.element, 71 this.deleteButton.element,
76 this.disableButton.element, 72 this.disableButton.element];
77 this.importButton.element];
78
79 console.log("handle mousedown");
80 73
81 if(nonBlurringElements.indexOf(e.target) === -1) { 74 if(nonBlurringElements.indexOf(e.target) === -1) {
82 this.editing = false; 75 this.editing = false;
@@ -112,7 +105,7 @@ exports.StyleSheet = Montage.create(Component, {
112 handleDeleteButtonAction : { 105 handleDeleteButtonAction : {
113 value: function(e) { 106 value: function(e) {
114 e.stopPropagation(); 107 e.stopPropagation();
115 debugger; 108 this.parentComponent.parentComponent.handleDeleteAction(this);
116 } 109 }
117 }, 110 },
118 111
@@ -208,6 +201,8 @@ exports.StyleSheet = Montage.create(Component, {
208 return this._source; 201 return this._source;
209 }, 202 },
210 set: function(sheet) { 203 set: function(sheet) {
204 if(!sheet || sheet === this._source) { return; }
205
211 console.log('sheet being set: ', this); 206 console.log('sheet being set: ', this);
212 207
213 this._extractData(sheet.ownerNode); 208 this._extractData(sheet.ownerNode);
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 6e1638a6..bbefc69b 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
@@ -11,16 +11,14 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
11 <script type="text/montage-serialization"> 11 <script type="text/montage-serialization">
12 { 12 {
13 "owner": { 13 "owner": {
14 "module" : "js/panels/css-panel/style-sheets-view.reel", 14 "prototype" : "js/panels/css-panel/style-sheets-view.reel",
15 "name" : "StyleSheetsView",
16 "properties" : { 15 "properties" : {
17 "element" : {"#" : "style-sheets-view-container"}, 16 "element" : {"#" : "style-sheets-view-container"},
18 "styleSheetList" : {"@" : "styleSheetList"} 17 "styleSheetList" : {"@" : "styleSheetList"}
19 } 18 }
20 }, 19 },
21 "arrayController" : { 20 "arrayController" : {
22 "module" : "montage/ui/controller/array-controller", 21 "prototype" : "montage/ui/controller/array-controller",
23 "name": "ArrayController",
24 "bindings": { 22 "bindings": {
25 "content": { 23 "content": {
26 "boundObject": {"@": "owner"}, 24 "boundObject": {"@": "owner"},
@@ -30,16 +28,14 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
30 } 28 }
31 }, 29 },
32 "styleSheetList": { 30 "styleSheetList": {
33 "module" : "montage/ui/repetition.reel", 31 "prototype" : "montage/ui/repetition.reel",
34 "name": "Repetition",
35 "properties": { 32 "properties": {
36 "element": {"#": "sheet-list" }, 33 "element": {"#": "sheet-list" },
37 "contentController": {"@": "arrayController"} 34 "contentController": {"@": "arrayController"}
38 } 35 }
39 },