From 747616980cad14f0b65fbcc7f497ed9680a39d29 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 15 Feb 2012 14:55:21 -0800 Subject: Adding more components pi Added rest of the components pi. Missing text-input and select Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 14 ++++++-- .../ComponentsPanelBase.js | 8 +++-- node_modules/components-data/checkbox.json | 38 ++++++++++++++++++--- node_modules/components-data/image.json | 16 ++++++--- node_modules/components-data/number-input.json | 17 ++++++---- node_modules/components-data/radio-button.json | 39 +++++++++++++++++++--- node_modules/components-data/range-input.json | 17 ++++++---- node_modules/components-data/textarea.json | 21 +++++++++--- 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, { case "top": case "width": case "height": - return ElementController.getProperty(el, prop, true); + if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { + return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + } else { + return ElementController.getProperty(el, prop, true); + } default: return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; } @@ -34,9 +38,15 @@ exports.ComponentController = Montage.create(ElementController, { case "top": case "width": case "height": - ElementController.setProperty(el, p, value); + if(el.nodeName === "IMG" && (p === "width" || p === "height")) { + this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + } else { + ElementController.setProperty(el, p, value); + } break; default: + if(p === "min" || p === "max") value = parseFloat(value); + this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; break; 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 return "checkbox"; case "select": return "dropdown"; + case "number": + return "hottext"; default: alert("Conversion not implemented for ", type); } @@ -287,7 +289,9 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component break; case "imageComponent": el = NJUtils.makeNJElement("image", "Image", "component"); - el.elementModel.pi = "ImageComponentPi"; + el.elementModel.pi = "ImagePi"; + el.setAttribute("width", 200); + el.setAttribute("height", 200); break; case "numberInput": el = NJUtils.makeNJElement("input", "Number Input", "component"); @@ -315,7 +319,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component break; case "textarea": el = NJUtils.makeNJElement("textarea", "TextArea", "component"); - el.elementModel.pi = "TextArea"; + el.elementModel.pi = "TextAreaPi"; break; case "toggleButton": 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 @@ "properties": [ { - "name": "label", + "name": "autofocus", + "type": "boolean", + "default": "false" + }, + { + "name": "disabled", + "type": "boolean", + "default": "false" + }, + { + "name": "checked", + "type": "boolean", + "default": "false" + }, + { + "name": "form", "type": "string", - "default": "Button" + "default": "" }, { - "name": "enabled", + "name": "name", + "type": "string", + "default": "" + }, + { + "name": "readonly", "type": "boolean", - "default": "true" + "default": null + }, + { + "name": "title", + "type": "string", + "default": "" + }, + { + "name": "value", + "type": "string", + "default": "on" } ] } \ 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 @@ "properties": [ { - "name": "label", + "name": "alt", "type": "string", - "default": "Button" + "default": "" }, { - "name": "enabled", - "type": "boolean", - "default": "true" + "name": "src", + "type": "string", + "default": "" + }, + { + "name": "title", + "type": "string", + "default": "" } + ] } \ 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 @@ "properties": [ { - "name": "label", - "type": "string", - "default": "Button" + "name": "min", + "type": "number", + "default": null + }, + { + "name": "max", + "type": "number", + "default": null }, { - "name": "enabled", - "type": "boolean", - "default": "true" + "name": "step", + "type": "string", + "default": null } ] } \ 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 @@ "name": "RadioButton", "properties": [ - { - "name": "label", + "name": "autofocus", + "type": "boolean", + "default": "false" + }, + { + "name": "disabled", + "type": "boolean", + "default": "false" + }, + { + "name": "checked", + "type": "boolean", + "default": "false" + }, + { + "name": "form", "type": "string", - "default": "Button" + "default": "" }, { - "name": "enabled", + "name": "name", + "type": "string", + "default": "" + }, + { + "name": "readonly", "type": "boolean", - "default": "true" + "default": null + }, + { + "name": "title", + "type": "string", + "default": "" + }, + { + "name": "value", + "type": "string", + "default": "on" } ] } \ No newline at end of file diff --git a/node_modules/components-data/range-input.json b/node_modules/components-data/range-input.json index 44950890..871f7889 100644 --- a/node_modules/components-data/range-input.json +++ b/node_modules/components-data/range-input.json @@ -8,14 +8,19 @@ "properties": [ { - "name": "label", - "type": "string", - "default": "Button" + "name": "min", + "type": "number", + "default": null + }, + { + "name": "max", + "type": "number", + "default": null }, { - "name": "enabled", - "type": "boolean", - "default": "true" + "name": "step", + "type": "string", + "default": null } ] } \ No newline at end of file diff --git a/node_modules/components-data/textarea.json b/node_modules/components-data/textarea.json index 608011e1..6e3d78c2 100644 --- a/node_modules/components-data/textarea.json +++ b/node_modules/components-data/textarea.json @@ -8,14 +8,25 @@ "properties": [ { - "name": "value", + "name": "rows", + "type": "number", + "default": null + }, + { + "name": "cols", + "type": "number", + "default": null + }, + { + "name": "wrap", "type": "string", - "default": "Button" + "default": "soft", + "possibleValues": ["hard", "soft"] }, { - "name": "disabled", - "type": "boolean", - "default": "false" + "name": "textContent", + "type": "string", + "default": null } ] } \ No newline at end of file diff --git a/node_modules/components-data/toggle-button.json b/node_modules/components-data/toggle-button.json index 88b6eff0..e85dd72a 100644 --- a/node_modules/components-data/toggle-button.json +++ b/node_modules/components-data/toggle-button.json @@ -8,14 +8,29 @@ "properties": [ { - "name": "label", + "name": "pressed", + "type": "boolean", + "default": "false" + }, + { + "name": "unpressedLabel", "type": "string", - "default": "Button" + "default": "" }, { - "name": "enabled", - "type": "boolean", - "default": "true" + "name": "pressedLabel", + "type": "string", + "default": "" + }, + { + "name": "pressedClass", + "type": "string", + "default": "pressed" + }, + { + "name": "label", + "type": "string", + "default": "" } ] } \ No newline at end of file -- cgit v1.2.3