From 197a7646e472fcea616764685c8d03c6063e66f5 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 18 May 2012 14:05:06 -0700 Subject: CSS Panel - Add support for deleting style sheets --- .../css-panel/style-sheet.reel/style-sheet.html | 16 ---------------- js/panels/css-panel/style-sheet.reel/style-sheet.js | 21 ++++++++------------- 2 files changed, 8 insertions(+), 29 deletions(-) (limited to 'js/panels/css-panel/style-sheet.reel') 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 "editButton": {"@": "editButton"}, "editView": {"#": "style-sheet-edit"}, "disableButton": {"@": "disableButton"}, - "importButton": {"@": "importButton"}, "deleteButton": {"@": "deleteButton"} } }, @@ -74,20 +73,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "listener": {"@": "owner"} }] - }, - "importButton": { - "module": "montage/ui/button.reel", - "name": "Button", - "properties": { - "element": {"#": "import-button"}, - "identifier": "importButton", - "label": "Import" - }, - "listeners": [{ - "type": "action", - "listener": {"@": "owner"} - }] - }, "deleteButton": { "module": "montage/ui/button.reel", @@ -118,7 +103,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot - 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, { _translateDistance: { value: null }, + viewContainer : { + value: null, + serializable: true + }, prepareForDraw : { value: function() { @@ -43,14 +47,6 @@ exports.StyleSheet = Montage.create(Component, { this.editView.style.removeProperty(transStr); } - if(this._readOnly) { - this._element.classList.add('ss-locked'); - this.importButton.element.classList.remove('ss-invisible'); - } else { - this._element.classList.remove('ss-locked'); - this.importButton.element.classList.add('ss-invisible'); - } - if(this.default) { this._element.classList.add('default-style-sheet'); } else { @@ -73,10 +69,7 @@ exports.StyleSheet = Montage.create(Component, { var nonBlurringElements = [ this.editView, this.deleteButton.element, - this.disableButton.element, - this.importButton.element]; - - console.log("handle mousedown"); + this.disableButton.element]; if(nonBlurringElements.indexOf(e.target) === -1) { this.editing = false; @@ -112,7 +105,7 @@ exports.StyleSheet = Montage.create(Component, { handleDeleteButtonAction : { value: function(e) { e.stopPropagation(); - debugger; + this.parentComponent.parentComponent.handleDeleteAction(this); } }, @@ -208,6 +201,8 @@ exports.StyleSheet = Montage.create(Component, { return this._source; }, set: function(sheet) { + if(!sheet || sheet === this._source) { return; } + console.log('sheet being set: ', this); this._extractData(sheet.ownerNode); -- cgit v1.2.3