From afcaa157f7bc067cf00de91b43b2a71e9b64b7b3 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 9 Apr 2012 15:43:10 -0700 Subject: Style sheet - Style update --- .../css-panel/style-sheet.reel/style-sheet.css | 34 ++++- .../css-panel/style-sheet.reel/style-sheet.html | 57 +++++++- .../css-panel/style-sheet.reel/style-sheet.js | 162 ++++++++++++++++++--- 3 files changed, 220 insertions(+), 33 deletions(-) (limited to 'js/panels') diff --git a/js/panels/css-panel/style-sheet.reel/style-sheet.css b/js/panels/css-panel/style-sheet.reel/style-sheet.css index b64c1d69..9ea03be8 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.css +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.css @@ -20,6 +20,20 @@ position: relative; -webkit-box-flex: 0; } +.ss-icon { + background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89%2BbN%2FrXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz%2FSMBAPh%2BPDwrIsAHvgABeNMLCADATZvAMByH%2Fw%2FqQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf%2BbTAICd%2BJl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA%2Fg88wAAKCRFRHgg%2FP9eM4Ors7ONo62Dl8t6r8G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%2F2j5sfVT0Kf7kxmTk%2F8EA5jz%2FGMzLdsAAAAgY0hSTQAAeiUAAICDAAD5%2FwAAgOkAAHUwAADqYAAAOpgAABdvkl%2FFRgAAAKJJREFUeNrUU7ERwyAMfOU8BDUrxNukcCf3HsQ96SgyiqnwCq69xadKLtiYAqr8nQr%2BBNKLl5BEC25oRPMDXXJagek1FTXNj1lw%2FyFIfkNVuSwLc1BVMhKMTO50xwrGGGzbVikBwL7v2cRhGDA%2BRzp1cjlEp0689w1DPEip%2BsZSFx8Z1T7IdXUpwVp74kIIJ06SXViBfuyLRoouJkaS%2F1%2Bm9wA1r162GS72SwAAAABJRU5ErkJggg%3D%3D); + background-position: 0 1px; + background-repeat: no-repeat; + height: 15px; + margin-right: 4px; + width: 15px; + -webkit-box-flex: 0; +} +.ss-locked .ss-icon { + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAMCAYAAAC0qUeeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw%2FeHBhY2tldCBiZWdpbj0i77u%2FIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8%2BIDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYxIDY0LjE0MDk0OSwgMjAxMC8xMi8wNy0xMDo1NzowMSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNS4xIE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpEMDA5RjUwNDc3Q0IxMUUxOThGODg2OTQ2NzQzQTM4QyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpEMDA5RjUwNTc3Q0IxMUUxOThGODg2OTQ2NzQzQTM4QyI%2BIDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkQwMDlGNTAyNzdDQjExRTE5OEY4ODY5NDY3NDNBMzhDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkQwMDlGNTAzNzdDQjExRTE5OEY4ODY5NDY3NDNBMzhDIi8%2BIDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY%2BIDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8%2B5IAEXQAAAD1JREFUeNpi%2FP%2F%2FPwMInD17FsLAAkxMTBhBNBMDCYAJn0kYihkZGRlAGF0hNg2MZ86c%2BU%2BRM0YVEwMAAgwAPiAMV%2F3dGHMAAAAASUVORK5CYII%3D); + background-position: center center; + background-repeat: no-repeat; +} .style-sheet-container span { min-width: 50px; overflow: hidden; @@ -65,8 +79,13 @@ outline: 0 none; box-shadow: none; } - +.style-sheet-container .ss-edit-button:active { + -webkit-transition: -webkit-transform 3s cubic-bezier(.44,.19,0,.99); + -webkit-transform: rotate(360deg); +} .style-sheet-edit { + display: -webkit-box; + -webkit-box-orient: horizontal; position: absolute; top: 0; right: 0; @@ -80,17 +99,21 @@ .style-sheet-edit.expanded .ss-edit-button { background-color: #363636; border-color: rgba(80, 80, 80, 1); + -webkit-box-flex: 0; opacity: 1; } + .style-sheet-edit.expanded { background-color: #363636; } .style-sheet-edit button.nj-skinned { + -webkit-box-flex: .2; height: 20px; padding: 2px 10px; margin-left: 9px; margin-right: -4px; top: 2px; + max-width: 40px; position: relative; text-transform: capitalize; font-size: 10px; @@ -99,6 +122,11 @@ background: -webkit-linear-gradient(top, rgba(91,57,56,1) 0%,rgba(53,35,35,1) 100%); } .style-sheet-edit button.ss-disable-button { - position: absolute; - right: 25px; + /*position: absolute;*/ + /*right: 25px;*/ + margin-right: 25px; +} + +.ss-invisible { + display: none; } \ No newline at end of file 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 1c47ce3f..1820f780 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.html +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.html @@ -15,11 +15,13 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "name" : "StyleSheet", "properties" : { "element" : {"#" : "style-sheet-container"}, - "disableCheckbox": {"@": "disableCheckbox"}, "nameText": {"@": "name"}, "mediaInput": {"@": "mediaInput"}, "editButton": {"@": "editButton"}, - "editView": {"#": "style-sheet-edit"} + "editView": {"#": "style-sheet-edit"}, + "disableButton": {"@": "disableButton"}, + "importButton": {"@": "importButton"}, + "deleteButton": {"@": "deleteButton"} } }, "disableCheckbox": { @@ -65,13 +67,56 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "listener": {"@": "owner"} }] + }, + "disableButton": { + "module": "montage/ui/button.reel", + "name": "Button", + "properties": { + "element": {"#": "disable-button"}, + "identifier": "disableButton", + "label": "Disable" + }, + "listeners": [{ + "type": "action", + "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", + "name": "Button", + "properties": { + "element": {"#": "delete-button"}, + "identifier": "deleteButton", + "label": "Delete" + }, + "listeners": [{ + "type": "action", + "listener": {"@": "owner"} + }] + } }
-
+
+
@@ -79,9 +124,9 @@ 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 4f9ad21f..9ad48a62 100644 --- a/js/panels/css-panel/style-sheet.reel/style-sheet.js +++ b/js/panels/css-panel/style-sheet.reel/style-sheet.js @@ -14,8 +14,6 @@ exports.StyleSheet = Montage.create(Component, { willDraw : { value: function() { - console.log("style sheet view - will draw"); - if(this.editing) { document.body.addEventListener('mousedown', this, false); this._translateDistance = this._element.offsetWidth - this.editButton._element.offsetWidth; @@ -28,7 +26,6 @@ exports.StyleSheet = Montage.create(Component, { draw : { value: function() { var transStr = '-webkit-transform'; - console.log("styles sheet view - draw"); this.mediaInput.value = this._source.media.mediaText; @@ -39,17 +36,64 @@ exports.StyleSheet = Montage.create(Component, { this.editView.classList.remove('expanded'); 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'); + } + } }, + /* ------ Events------ */ + handleMousedown : { + value: function(e) { + var nonBlurringElements = [ + this.editView, + this.deleteButton.element, + this.disableButton.element, + this.importButton.element]; + + console.log("handle mousedown"); + + if(nonBlurringElements.indexOf(e.target) === -1) { + this.editing = false; + } + } + }, handleEditButtonAction: { value: function(e) { - console.log('handle edit button action'); this.editing = true; } }, + + handleImportButtonAction: { + value: function(e) { + e.stopPropagation(); + } + }, + + handleDisableButtonAction: { + value: function(e) { + e.stopPropagation(); + this.disabled = !this.disabled; + } + }, + + handleDeleteButtonAction : { + value: function(e) { + e.stopPropagation(); + debugger; + } + }, + + /* ------ State properties ------ */ + _editing : { value: null }, @@ -63,21 +107,9 @@ exports.StyleSheet = Montage.create(Component, { } }, - handleMousedown : { - value: function(e) { - console.log("handle mousedown"); - if(e.target !== this.editView && e.target !== this.editButton) { - this.editing = false; - } - } - }, - - mediaInput: { - value: null - }, - _name: { - value: null + value: "Style Tag", + distinct: true }, name : { get: function() { @@ -87,6 +119,37 @@ exports.StyleSheet = Montage.create(Component, { this._name = text; } }, + _readOnly : { value: null }, + readOnly : { + get: function() { + return this._readOnly; + }, + set: function(isReadOnly) { + this._readOnly = isReadOnly; + this.needsDraw = true; + } + }, + + _disabled : { + value: null + }, + disabled: { + get: function() { + return this._disabled; + }, + set: function(disable) { + var label = (disable) ? "Enable" : "Disable"; + this._source.ownerNode.disabled = disable; + this.disableButton.label = label; + + this._disabled = disable; + } + }, + + external : { + value: null + }, + _source : { value: null }, @@ -95,13 +158,64 @@ exports.StyleSheet = Montage.create(Component, { return this._source; }, set: function(sheet) { - console.log('sheet being set: ', sheet.ownerNode); - if(sheet.href) { - this.name = sheet.href.substring(sheet.href.lastIndexOf('/')+1); - } else { - this.name = 'Style Tag'; - } + console.log('sheet being set: ', this); + + this._extractData(sheet.ownerNode); this._source = sheet; } + }, + + _extractData : { + value: function(sheetNode) { + var data = sheetNode.dataset, key; + + for(key in data) { + this[key] = data[key]; + } + } + }, + + /* ------ Data Attribute Properties ------ */ + + _ninjaExternalUrl: { value: null }, + ninjaExternalUrl : { + get: function() { return this._ninjaExternalUrl; }, + set: function(url) { + this.external = true; + this._ninjaExternalUrl = url; + } + }, + + _ninjaFileName: { value: null }, + ninjaFileName : { + get: function() { return this._ninjaFileName; }, + set: function(fileName) { + this.name = fileName; + this._ninjaFileName = fileName; + } + }, + + _ninjaFileUrl: { value: null }, + ninjaFileUrl : { + get: function() { return this._ninjaFileUrl; }, + set: function(fileUrl) { + this._ninjaFileUrl = fileUrl; + } + }, + + _ninjaFileReadOnly: { value: null }, + ninjaFileReadOnly : { + get: function() { return this._ninjaFileReadOnly; }, + set: function(isReadOnly) { + this._ninjaFileReadOnly = this.readOnly = isReadOnly === "true"; + } + }, + + _ninjaUri: { value: null }, + ninjaUri : { + get: function() { return this._ninjaUri; }, + set: function(uri) { + this._ninjaUri = uri; + } } }); \ No newline at end of file -- cgit v1.2.3