diff options
author | Valerio Virgillito | 2012-02-15 14:55:21 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-15 14:55:21 -0800 |
commit | 747616980cad14f0b65fbcc7f497ed9680a39d29 (patch) | |
tree | d04fe7a572fd6a0a17a6c631988989e9cd9e43a6 | |
parent | d1bc0d3e8b3ab3341105c3e29dd2ca11a20d8931 (diff) | |
download | ninja-747616980cad14f0b65fbcc7f497ed9680a39d29.tar.gz |
Adding more components pi
Added rest of the components pi.
Missing text-input and select
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
-rw-r--r-- | js/controllers/elements/component-controller.js | 14 | ||||
-rw-r--r-- | js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | 8 | ||||
-rw-r--r-- | node_modules/components-data/checkbox.json | 38 | ||||
-rw-r--r-- | node_modules/components-data/image.json | 16 | ||||
-rw-r--r-- | node_modules/components-data/number-input.json | 17 | ||||
-rw-r--r-- | node_modules/components-data/radio-button.json | 39 | ||||
-rw-r--r-- | node_modules/components-data/range-input.json | 17 | ||||
-rw-r--r-- | node_modules/components-data/textarea.json | 21 | ||||
-rw-r--r-- | node_modules/components-data/toggle-button.json | 25 |
9 files changed, 155 insertions, 40 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 7fa62d1e..83450d0f 100644 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js | |||
@@ -18,7 +18,11 @@ exports.ComponentController = Montage.create(ElementController, { | |||
18 | case "top": | 18 | case "top": |
19 | case "width": | 19 | case "width": |
20 | case "height": | 20 | case "height": |
21 | return ElementController.getProperty(el, prop, true); | 21 | if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { |
22 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | ||
23 | } else { | ||
24 | return ElementController.getProperty(el, prop, true); | ||
25 | } | ||
22 | default: | 26 | default: |
23 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; | 27 | return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; |
24 | } | 28 | } |
@@ -34,9 +38,15 @@ exports.ComponentController = Montage.create(ElementController, { | |||
34 | case "top": | 38 | case "top": |
35 | case "width": | 39 | case "width": |
36 | case "height": | 40 | case "height": |
37 | ElementController.setProperty(el, p, value); | 41 | if(el.nodeName === "IMG" && (p === "width" || p === "height")) { |
42 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | ||
43 | } else { | ||
44 | ElementController.setProperty(el, p, value); | ||
45 | } | ||
38 | break; | 46 | break; |
39 | default: | 47 | default: |
48 | if(p === "min" || p === "max") value = parseFloat(value); | ||
49 | |||
40 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; | 50 | this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; |
41 | break; | 51 | break; |
42 | 52 | ||
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js index 987cd6b5..bcb14013 100644 --- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js +++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js | |||
@@ -195,6 +195,8 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
195 | return "checkbox"; | 195 | return "checkbox"; |
196 | case "select": | 196 | case "select": |
197 | return "dropdown"; | 197 | return "dropdown"; |
198 | case "number": | ||
199 | return "hottext"; | ||
198 | default: | 200 | default: |
199 | alert("Conversion not implemented for ", type); | 201 | alert("Conversion not implemented for ", type); |
200 | } | 202 | } |
@@ -287,7 +289,9 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
287 | break; | 289 | break; |
288 | case "imageComponent": | 290 | case "imageComponent": |
289 | el = NJUtils.makeNJElement("image", "Image", "component"); | 291 | el = NJUtils.makeNJElement("image", "Image", "component"); |
290 | el.elementModel.pi = "ImageComponentPi"; | 292 | el.elementModel.pi = "ImagePi"; |
293 | el.setAttribute("width", 200); | ||
294 | el.setAttribute("height", 200); | ||
291 | break; | 295 | break; |
292 | case "numberInput": | 296 | case "numberInput": |
293 | el = NJUtils.makeNJElement("input", "Number Input", "component"); | 297 | el = NJUtils.makeNJElement("input", "Number Input", "component"); |
@@ -315,7 +319,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component | |||
315 | break; | 319 | break; |
316 | case "textarea": | 320 | case "textarea": |
317 | el = NJUtils.makeNJElement("textarea", "TextArea", "component"); | 321 | el = NJUtils.makeNJElement("textarea", "TextArea", "component"); |
318 | el.elementModel.pi = "TextArea"; | 322 | el.elementModel.pi = "TextAreaPi"; |
319 | break; | 323 | break; |
320 | case "toggleButton": | 324 | case "toggleButton": |
321 | el = NJUtils.makeNJElement("button", "Toggle Button", "component"); | 325 | el = NJUtils.makeNJElement("button", "Toggle Button", "component"); |
diff --git a/node_modules/components-data/checkbox.json b/node_modules/components-data/checkbox.json index 8991d210..a03ee00f 100644 --- a/node_modules/components-data/checkbox.json +++ b/node_modules/components-data/checkbox.json | |||
@@ -8,14 +8,44 @@ | |||
8 | "properties": [ | 8 | "properties": [ |
9 | 9 | ||
10 | { | 10 | { |
11 | "name": "label", | 11 | "name": "autofocus", |
12 | "type": "boolean", | ||
13 | "default": "false" | ||
14 | }, | ||
15 | { | ||
16 | "name": "disabled", | ||
17 | "type": "boolean", | ||
18 | "default": "false" | ||
19 | }, | ||
20 | { | ||
21 | "name": "checked", | ||
22 | "type": "boolean", | ||
23 | "default": "false" | ||
24 | }, | ||
25 | { | ||
26 | "name": "form", | ||
12 | "type": "string", | 27 | "type": "string", |
13 | "default": "Button" | 28 | "default": "" |
14 | }, | 29 | }, |
15 | { | 30 | { |
16 | "name": "enabled", | 31 | "name": "name", |
32 | "type": "string", | ||
33 | "default": "" | ||
34 | }, | ||
35 | { | ||
36 | "name": "readonly", | ||
17 | "type": "boolean", | 37 | "type": "boolean", |
18 | "default": "true" | 38 | "default": null |
39 | }, | ||
40 | { | ||
41 | "name": "title", | ||
42 | "type": "string", | ||
43 | "default": "" | ||
44 | }, | ||
45 | { | ||
46 | "name": "value", | ||
47 | "type": "string", | ||
48 | "default": "on" | ||
19 | } | 49 | } |
20 | ] | 50 | ] |
21 | } \ No newline at end of file | 51 | } \ No newline at end of file |
diff --git a/node_modules/components-data/image.json b/node_modules/components-data/image.json index 4a90ec5b..d6080196 100644 --- a/node_modules/components-data/image.json +++ b/node_modules/components-data/image.json | |||
@@ -8,14 +8,20 @@ | |||
8 | "properties": [ | 8 | "properties": [ |
9 | 9 | ||
10 | { | 10 | { |
11 | "name": "label", | 11 | "name": "alt", |
12 | "type": "string", | 12 | "type": "string", |
13 | "default": "Button" | 13 | "default": "" |
14 | }, | 14 | }, |
15 | { | 15 | { |
16 | "name": "enabled", | 16 | "name": "src", |
17 | "type": "boolean", | 17 | "type": "string", |
18 | "default": "true" | 18 | "default": "" |
19 | }, | ||
20 | { | ||
21 | "name": "title", | ||
22 | "type": "string", | ||
23 | "default": "" | ||
19 | } | 24 | } |
25 | |||
20 | ] | 26 | ] |
21 | } \ No newline at end of file | 27 | } \ No newline at end of file |
diff --git a/node_modules/components-data/number-input.json b/node_modules/components-data/number-input.json index 1898ec4f..d446fc37 100644 --- a/node_modules/components-data/number-input.json +++ b/node_modules/components-data/number-input.json | |||
@@ -8,14 +8,19 @@ | |||
8 | "properties": [ | 8 | "properties": [ |
9 | 9 | ||
10 | { | 10 | { |
11 | "name": "label", | 11 | "name": "min", |
12 | "type": "string", | 12 | "type": "number", |
13 | "default": "Button" | 13 | "default": null |
14 | }, | ||
15 | { | ||
16 | "name": "max", | ||
17 | "type": "number", | ||
18 | "default": null | ||
14 | }, | 19 | }, |
15 | { | 20 | { |
16 | "name": "enabled", | 21 | "name": "step", |
17 | "type": "boolean", | 22 | "type": "string", |
18 | "default": "true" | 23 | "default": null |
19 | } | 24 | } |
20 | ] | 25 | ] |
21 | } \ No newline at end of file | 26 | } \ No newline at end of file |
diff --git a/node_modules/components-data/radio-button.json b/node_modules/components-data/radio-button.json index e76cc6b4..4763453a 100644 --- a/node_modules/components-data/radio-button.json +++ b/node_modules/components-data/radio-button.json | |||
@@ -6,16 +6,45 @@ | |||
6 | "name": "RadioButton", | 6 | "name": "RadioButton", |
7 | 7 | ||
8 | "properties": [ | 8 | "properties": [ |
9 | |||
10 | { | 9 | { |
11 | "name": "label", | 10 | "name": "autofocus", |
11 | "type": "boolean", | ||
12 | "default": "false" | ||
13 | }, | ||
14 | { | ||
15 | "name": "disabled", | ||
16 | "type": "boolean", | ||