aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/style-sheet.reel
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/style-sheet.reel
parent18c260f5f55608d4774aea27f6c2d23e89921361 (diff)
downloadninja-197a7646e472fcea616764685c8d03c6063e66f5.tar.gz
CSS Panel - Add support for deleting style sheets
Diffstat (limited to 'js/panels/css-panel/style-sheet.reel')
-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
2 files changed, 8 insertions, 29 deletions
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);