aboutsummaryrefslogtreecommitdiff
path: root/js/panels/css-panel/css-style.reel
diff options
context:
space:
mode:
authorEric Guzman2012-05-10 13:21:38 -0700
committerEric Guzman2012-05-10 13:21:38 -0700
commit6056a569caab94bdbdc2c60b58907109ff468dd3 (patch)
treef48716a7a82ab8d1d70ccefe12e71076d97cf610 /js/panels/css-panel/css-style.reel
parent830b6577ee25a6955bd4e275f216e1cadeff168c (diff)
downloadninja-6056a569caab94bdbdc2c60b58907109ff468dd3.tar.gz
Style Declaration - Improved updating of styles using binding.
Diffstat (limited to 'js/panels/css-panel/css-style.reel')
-rw-r--r--js/panels/css-panel/css-style.reel/css-style.js43
1 files changed, 6 insertions, 37 deletions
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 b021dc0f..face668e 100644
--- a/js/panels/css-panel/css-style.reel/css-style.js
+++ b/js/panels/css-panel/css-style.reel/css-style.js
@@ -13,6 +13,7 @@ exports.CssStyle = Montage.create(Component, {
13 editingStyleClass : { value: 'edit-style-item' }, 13 editingStyleClass : { value: 'edit-style-item' },
14 editNewEmptyClass : { value: 'edit-empty-style' }, 14 editNewEmptyClass : { value: 'edit-empty-style' },
15 invalidStyleClass : { value: "style-item-invalid" }, 15 invalidStyleClass : { value: "style-item-invalid" },
16 emptyStyleClass : { value: "empty-css-style" },
16 17
17 propertyText : { value: "property" }, 18 propertyText : { value: "property" },
18 _valueText : { value: "value" }, 19 _valueText : { value: "value" },
@@ -240,7 +241,7 @@ exports.CssStyle = Montage.create(Component, {
240 241
241 this.editing = false; 242 this.editing = false;
242 243
243 if(this.sourceObject.isEmpty && !this.dirty && !fieldsClicked.bind(this)()) { 244 if(this.empty && !this.dirty && !fieldsClicked.bind(this)()) {
244 ///// Show add button 245 ///// Show add button
245 this.editingNewStyle = false; 246 this.editingNewStyle = false;
246 } 247 }
@@ -265,7 +266,7 @@ exports.CssStyle = Montage.create(Component, {
265 266
266 this.editing = false; 267 this.editing = false;
267 268
268 if(this.sourceObject.isEmpty && !this.dirty && !fieldsClicked.bind(this)()) { 269 if(this.empty && !this.dirty && !fieldsClicked.bind(this)()) {
269 ///// Show add button 270 ///// Show add button
270 this.editingNewStyle = false; 271 this.editingNewStyle = false;
271 } 272 }
@@ -306,39 +307,9 @@ exports.CssStyle = Montage.create(Component, {
306 } 307 }
307 }, 308 },
308 309
309// handleSourceObjectSet: {
310// value: function() {
311// this.propertyText = this.sourceObject.name;
312// this.valueText = this.sourceObject.value;
313//
314// if(this.sourceObject.isEmpty) {
315// this.empty = true;
316// }
317// }
318// },
319
320 _sourceObject : { value: null },
321 sourceObject: {
322 get: function() {
323 return this._sourceObject;
324 },
325 set: function(sourceObject) {
326 this._sourceObject = sourceObject;
327
328 this.propertyText = sourceObject.name;
329 this.valueText = sourceObject.value;
330
331 if(sourceObject.isEmpty) {
332 this.empty = true;
333 }
334 }
335 },
336
337 templateDidLoad : { 310 templateDidLoad : {
338 value: function() { 311 value: function() {
339 //this.delegate = this.treeView.contentController.delegate; 312 this.propertyField.hints = this.propertyNames;
340//debugger;
341 //this.propertyField.hints = this.propertyNames;
342 } 313 }
343 }, 314 },
344 315
@@ -402,17 +373,15 @@ exports.CssStyle = Montage.create(Component, {
402 value : function() { 373 value : function() {
403 if(this.empty) { 374 if(this.empty) {
404 this.element.draggable = false; 375 this.element.draggable = false;
405 this.element.classList.add('empty-css-style'); 376 this.element.classList.add(this.emptyStyleClass);
406 if(!this.addStyleButton.parentNode) { 377 if(!this.addStyleButton.parentNode) {
407 console.log("Adding style for ", this.propertyText);
408 this.element.appendChild(this.addStyleButton); 378 this.element.appendChild(this.addStyleButton);
409 this.addStyleButton.addEventListener('click', this, false); 379 this.addStyleButton.addEventListener('click', this, false);
410 } 380 }
411 } else { 381 } else {
412 this.element.draggable = true; 382 this.element.draggable = true;
413 this.element.classList.remove('empty-css-style'); 383 this.element.classList.remove(this.emptyStyleClass);
414 if(this.addStyleButton.parentNode) { 384 if(this.addStyleButton.parentNode) {
415 console.log("Removing style for ", this.propertyText);
416 this.element.removeChild(this.addStyleButton); 385 this.element.removeChild(this.addStyleButton);
417 } 386 }
418 } 387 }