aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-31 11:04:35 -0700
committerValerio Virgillito2012-05-31 11:04:35 -0700
commit6042bdc5f2aada4412912fd01602d32c9088dc26 (patch)
treee3add0911bdf1dca441f2ed96b5cf0defe6b12fb
parent2ea84629a355a02d7eaa33464a0298ec4999073c (diff)
parent535a2fae0f4820f9b5a9f33cec250f11c0ee5bb9 (diff)
downloadninja-6042bdc5f2aada4412912fd01602d32c9088dc26.tar.gz
Merge pull request #261 from ericguzman/CSSPanelUpdates
CSS Panel Toolbar - Prevent warning regarding undefined sourceObject
-rw-r--r--js/components/toolbar.reel/toolbar-button.js28
-rw-r--r--js/components/toolbar.reel/toolbar.html2
-rw-r--r--js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js9
-rw-r--r--js/panels/css-panel/rule-list-container.reel/rule-list-container.js8
-rw-r--r--js/panels/css-panel/style-declaration.reel/style-declaration.css3
-rw-r--r--js/panels/css-panel/style-declaration.reel/style-declaration.js10
-rw-r--r--js/panels/css-panel/styles-view-delegate.js9
7 files changed, 59 insertions, 10 deletions
diff --git a/js/components/toolbar.reel/toolbar-button.js b/js/components/toolbar.reel/toolbar-button.js
new file mode 100644
index 00000000..9ada9b29
--- /dev/null
+++ b/js/components/toolbar.reel/toolbar-button.js
@@ -0,0 +1,28 @@
1/* <copyright>
2 This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3 No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4 (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5 </copyright> */
6
7var Montage = require("montage").Montage,
8 Component = require("montage/ui/component").Component,
9 Button = require("montage/ui/button.reel/button").Button;
10
11var ToolbarButton = exports.ToolbarButton = Montage.create(Button, {
12 hasTemplate : {
13 value: false
14 },
15 _sourceObject : {
16 value: null
17 },
18 sourceObject : {
19 get: function() {
20 return this._sourceObject;
21 },
22 set: function(value) {
23 if(value === this._sourceObject) { return; }
24
25 this._sourceObject = value;
26 }
27 }
28}); \ No newline at end of file
diff --git a/js/components/toolbar.reel/toolbar.html b/js/components/toolbar.reel/toolbar.html
index d2c5972a..51e7ebec 100644
--- a/js/components/toolbar.reel/toolbar.html
+++ b/js/components/toolbar.reel/toolbar.html
@@ -30,7 +30,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
30 }, 30 },
31 31
32 "button": { 32 "button": {
33 "prototype": "montage/ui/button.reel", 33 "prototype": "js/components/toolbar.reel/toolbar-button",
34 "properties": { 34 "properties": {
35 "element": {"#": "button" }, 35 "element": {"#": "button" },
36 "label": " " 36 "label": " "
diff --git a/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
index e0ffb1a8..54181bf3 100644
--- a/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
+++ b/js/panels/css-panel/rule-components/css-style-rule.reel/css-style-rule.js
@@ -88,6 +88,14 @@ exports.CssStyleRule = Montage.create(Component, {
88 } 88 }
89 } 89 }
90 }, 90 },
91 handleStop : {
92 value: function(e) {
93 if(this.focusDelegate) {
94 e._event.detail.preventDefault();
95 this.focusDelegate.handleSelectorStop(this.rule, this.selectorField.value, this);
96 }
97 }
98 },
91 handleMouseover: { 99 handleMouseover: {
92 value: function(e) { 100 value: function(e) {
93 if(this.focusDelegate) { 101 if(this.focusDelegate) {
@@ -125,6 +133,7 @@ exports.CssStyleRule = Montage.create(Component, {
125 this.declarationComponent.type = 'inline'; 133 this.declarationComponent.type = 'inline';
126 } else { 134 } else {
127 this.selectorField.addEventListener('change', this, false); 135 this.selectorField.addEventListener('change', this, false);
136 this.selectorField.addEventListener('stop', this, false);
128 this.selectorField.element.addEventListener('mouseover', this, false); 137 this.selectorField.element.addEventListener('mouseover', this, false);
129 this.selectorField.element.addEventListener('mouseout', this, false); 138 this.selectorField.element.addEventListener('mouseout', this, false);
130 } 139 }
diff --git a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js
index e2e269ba..c7766d08 100644
--- a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js
+++ b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js
@@ -45,7 +45,7 @@ exports.RuleListContainer = Montage.create(Component, {
45 for(i = 0; i<this.ruleLists.length; i++) { 45 for(i = 0; i<this.ruleLists.length; i++) {
46 list = this.ruleLists[i]; 46 list = this.ruleLists[i];
47 47
48 if(selection.length > 1) { 48 if(selection.length === list.selection.length) {
49 matchesAll = selection.every(function(element, index, array) { 49 matchesAll = selection.every(function(element, index, array) {
50 return list.selection.indexOf(element) !== -1; 50 return list.selection.indexOf(element) !== -1;
51 }); 51 });
@@ -53,12 +53,6 @@ exports.RuleListContainer = Montage.create(Component, {
53 if(matchesAll) { 53 if(matchesAll) {
54 break; 54 break;
55 } 55 }
56 } else {
57 ///// Selection (single element or stylesheet) is the same,
58 ///// Use the existing rule list
59 if(list.selection[0] === selection[0]) {
60 break;
61 }
62 } 56 }
63 57
64 list = null; 58 list = null;
diff --git a/js/panels/css-panel/style-declaration.reel/style-declaration.css b/js/panels/css-panel/style-declaration.reel/style-declaration.css
index 6be8d33c..d4755b04 100644
--- a/js/panels/css-panel/style-declaration.reel/style-declaration.css
+++ b/js/panels/css-panel/style-declaration.reel/style-declaration.css
@@ -10,4 +10,7 @@
10} 10}
11.drag-over { 11.drag-over {
12 /*background-color: red;*/ 12 /*background-color: red;*/
13}
14.css-animation-prevent * {
15 -webkit-transition-duration: 0 !important;
13} \ No newline at end of file 16} \ No newline at end of file
diff --git a/js/panels/css-panel/style-declaration.reel/style-declaration.js b/js/panels/css-panel/style-declaration.reel/style-declaration.js
index 57cbdb63..6187989b 100644
--- a/js/panels/css-panel/style-declaration.reel/style-declaration.js
+++ b/js/panels/css-panel/style-declaration.reel/style-declaration.js
@@ -216,7 +216,15 @@ exports.StyleDeclaration = Montage.create(Component, {
216 }, 216 },
217 217
218 addNewStyle : { 218 addNewStyle : {
219 value: function() { 219 value: function(preventAnimation) {
220 if(preventAnimation) {
221 this.element.classList.add('css-animation-prevent');
222
223 setTimeout(function() {
224 this.element.classList.remove('css-animation-prevent');
225 }.bind(this), 1000);
226 }
227
220 this.addStyle('property', 'value', { 228 this.addStyle('property', 'value', {
221 isEmpty : true 229 isEmpty : true
222 }); 230 });
diff --git a/js/panels/css-panel/styles-view-delegate.js b/js/panels/css-panel/styles-view-delegate.js
index 454008fa..078bd521 100644
--- a/js/panels/css-panel/styles-view-delegate.js
+++ b/js/panels/css-panel/styles-view-delegate.js
@@ -75,6 +75,13 @@ exports.StylesViewDelegate = Montage.create(Component, {
75 this._dispatchChange(); 75 this._dispatchChange();
76 } 76 }
77 }, 77 },
78
79 handleSelectorStop : {
80 value: function(rule, newSelector, ruleComponent) {
81 ruleComponent.declarationComponent.repetition.childComponents[0].propertyField.start()
82 }
83 },
84
78 _getClassNameFromSelector : { 85 _getClassNameFromSelector : {
79 value: function(selectorText) { 86 value: function(selectorText) {
80 var results = /.*\.([A-Za-z0-9_-]+)\:?[A-Za-z0-9_"=-]*$/.exec(selectorText); 87 var results = /.*\.([A-Za-z0-9_-]+)\:?[A-Za-z0-9_"=-]*$/.exec(selectorText);
@@ -145,7 +152,7 @@ exports.StylesViewDelegate = Montage.create(Component, {
145 if(nextFocus) { 152 if(nextFocus) {
146 nextFocus.propertyField.start(); 153 nextFocus.propertyField.start();
147 } else if(style.dirty) { 154 } else if(style.dirty) {
148 style.parentComponent.parentComponent.addNewStyle(); 155 style.parentComponent.parentComponent.addNewStyle(true);
149 style.editingNewStyle = false; 156 style.editingNewStyle = false;
150 setTimeout(function() { 157 setTimeout(function() {
151 style.getSiblingStyle('next').propertyField.start(); 158 style.getSiblingStyle('next').propertyField.start();