diff options
author | Valerio Virgillito | 2012-02-16 22:45:55 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-16 22:45:55 -0800 |
commit | e67d1f472dab28b4ff6afc9d9cc06b34756e26b5 (patch) | |
tree | f17a01b3ad3ca11fc35e90133fae47fae668378c /js/controllers/elements/component-controller.js | |
parent | 9f0c4efe2ed9a00f2c5d85c9d88a8040fedb5d8f (diff) | |
parent | 90e2b3455a123af8751d63381609b3a5ae304051 (diff) | |
download | ninja-e67d1f472dab28b4ff6afc9d9cc06b34756e26b5.tar.gz |
Merge pull request #51 from mencio/components
Fixing the components not instantianting in the user document
Diffstat (limited to 'js/controllers/elements/component-controller.js')
-rwxr-xr-x | js/controllers/elements/component-controller.js | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 33b9b79a..83450d0f 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js | |||
@@ -12,20 +12,19 @@ exports.ComponentController = Montage.create(ElementController, { | |||
12 | getProperty: { | 12 | getProperty: { |
13 | value: function(el, prop) { | 13 | value: function(el, prop) { |
14 | switch(prop) { | 14 | switch(prop) { |
15 | case "label": | 15 | case "id": |
16 | return this.application.ninja.currentDocument.getComponentFromElement(el).label; | 16 | case "class": |
17 | break; | 17 | case "left": |
18 | case "enabled": | 18 | case "top": |
19 | return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; | 19 | case "width": |
20 | break; | 20 | case "height": |
21 | case "disabled": | 21 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { |
22 | return this.application.ninja.currentDocument.getComponentFromElement(el).disabled; | 22 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; |
23 | break; | 23 | } else { |
24 | case "value": | 24 | return ElementController.getProperty(el, prop, true); |
25 | return this.application.ninja.currentDocument.getComponentFromElement(el).value; | 25 | } |
26 | break; | ||
27 | default: | 26 | default: |
28 | return ElementController.getProperty(el, prop, true); | 27 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; |
29 | } | 28 | } |
30 | } | 29 | } |
31 | }, | 30 | }, |
@@ -33,20 +32,24 @@ exports.ComponentController = Montage.create(ElementController, { | |||
33 | setProperty: { | 32 | setProperty: { |
34 | value: function(el, p, value) { | 33 | value: function(el, p, value) { |
35 | switch(p) { | 34 | switch(p) { |
36 | case "label": | 35 | case "id": |
37 | this.application.ninja.currentDocument.getComponentFromElement(el).label = value; | 36 | case "class": |
38 | break; | 37 | case "left": |
39 | case "enabled": | 38 | case "top": |
40 | this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; | 39 | case "width": |
41 | break; | 40 | case "height": |
42 | case "disabled": | 41 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { |
43 | this.application.ninja.currentDocument.getComponentFromElement(el).disabled = value; | 42 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; |
44 | break; | 43 | } else { |
45 | case "value": | 44 | ElementController.setProperty(el, p, value); |
46 | this.application.ninja.currentDocument.getComponentFromElement(el).value = value; | 45 | } |
47 | break; | 46 | break; |
48 | default: | 47 | default: |
49 | ElementController.setProperty(el, p, value); | 48 | if(p === "min" || p === "max") value = parseFloat(value); |
49 | |||
50 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | ||
51 | break; | ||
52 | |||
50 | } | 53 | } |
51 | } | 54 | } |
52 | } | 55 | } |