From 695ca5c0cf39d2dcecef44623c1fb2df2f829374 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Wed, 26 Nov 2014 08:01:00 -0800 Subject: [PATCH] [Forms] Bring in initial work on forms Bring in previous work on the forms component; this includes transitioned versions of specific form elements, and the mct-form direction which generates these. WTD-530 --- platform/forms/bundle.json | 42 +++++++++++++++++++ platform/forms/res/templates/_checkbox.html | 6 +++ platform/forms/res/templates/_checkboxes.html | 0 platform/forms/res/templates/_datetime.html | 24 +++++++++++ platform/forms/res/templates/_select.html | 7 ++++ platform/forms/res/templates/_selects.html | 5 +++ platform/forms/res/templates/_textfield.html | 8 ++++ platform/forms/res/templates/form.html | 38 +++++++++++++++++ platform/forms/res/templates/textfields.html | 7 ++++ platform/forms/src/MCTForm.js | 31 ++++++++++++++ 10 files changed, 168 insertions(+) create mode 100644 platform/forms/bundle.json create mode 100644 platform/forms/res/templates/_checkbox.html create mode 100644 platform/forms/res/templates/_checkboxes.html create mode 100644 platform/forms/res/templates/_datetime.html create mode 100644 platform/forms/res/templates/_select.html create mode 100644 platform/forms/res/templates/_selects.html create mode 100644 platform/forms/res/templates/_textfield.html create mode 100644 platform/forms/res/templates/form.html create mode 100644 platform/forms/res/templates/textfields.html create mode 100644 platform/forms/src/MCTForm.js diff --git a/platform/forms/bundle.json b/platform/forms/bundle.json new file mode 100644 index 0000000000..776d0ee596 --- /dev/null +++ b/platform/forms/bundle.json @@ -0,0 +1,42 @@ +{ + "name": "MCT Forms", + "description": "Form generator; includes directive and some controls.", + "extensions": { + "directives": [ + { + "key": "mctForm", + "implementation": "MCTForm.js" + } + ], + "templates": [ + { + "key": "_checkbox", + "templateUrl": "templates/_checkbox.html" + }, + { + "key": "_checkboxes", + "templateUrl": "templates/_checkboxes.html" + }, + { + "key": "_datetime", + "templateUrl": "templates/_datetime.html" + }, + { + "key": "_select", + "templateUrl": "templates/_select.html" + }, + { + "key": "_selects", + "templateUrl": "templates/_selects.html" + }, + { + "key": "_textfield", + "templateUrl": "templates/_textfield.html" + }, + { + "key": "_textfields", + "templateUrl": "templates/_textfields.html" + } + ] + } +} \ No newline at end of file diff --git a/platform/forms/res/templates/_checkbox.html b/platform/forms/res/templates/_checkbox.html new file mode 100644 index 0000000000..1412c4ee14 --- /dev/null +++ b/platform/forms/res/templates/_checkbox.html @@ -0,0 +1,6 @@ +
+ +
\ No newline at end of file diff --git a/platform/forms/res/templates/_checkboxes.html b/platform/forms/res/templates/_checkboxes.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/platform/forms/res/templates/_datetime.html b/platform/forms/res/templates/_datetime.html new file mode 100644 index 0000000000..55e0f7bdcb --- /dev/null +++ b/platform/forms/res/templates/_datetime.html @@ -0,0 +1,24 @@ +
+
+
+ Date + Hour + Min + Sec + Timezone +
+ +
+ + + + + + + +
+
+
\ No newline at end of file diff --git a/platform/forms/res/templates/_select.html b/platform/forms/res/templates/_select.html new file mode 100644 index 0000000000..e778d76450 --- /dev/null +++ b/platform/forms/res/templates/_select.html @@ -0,0 +1,7 @@ +
+ +
diff --git a/platform/forms/res/templates/_selects.html b/platform/forms/res/templates/_selects.html new file mode 100644 index 0000000000..449051ed56 --- /dev/null +++ b/platform/forms/res/templates/_selects.html @@ -0,0 +1,5 @@ +
+ {#processedValues} + {#view key="_select"/} + {/processedValues} +
\ No newline at end of file diff --git a/platform/forms/res/templates/_textfield.html b/platform/forms/res/templates/_textfield.html new file mode 100644 index 0000000000..f351520231 --- /dev/null +++ b/platform/forms/res/templates/_textfield.html @@ -0,0 +1,8 @@ +
+ + + + + +
+ diff --git a/platform/forms/res/templates/form.html b/platform/forms/res/templates/form.html new file mode 100644 index 0000000000..b3dc0db27b --- /dev/null +++ b/platform/forms/res/templates/form.html @@ -0,0 +1,38 @@ +{{structure.name}} +
+ +
{{section.name}}
+
+ + + + + + + + + + +
+
{{row.name}}
+
+
+ +
+ {{item.control}} | Item.Key={{item.key}} | model={{model[item.key]}} + * + +
+
+
+
+
+
+ +CLICK! +
Model: {{model | json}}
+
\ No newline at end of file diff --git a/platform/forms/res/templates/textfields.html b/platform/forms/res/templates/textfields.html new file mode 100644 index 0000000000..39a01c489e --- /dev/null +++ b/platform/forms/res/templates/textfields.html @@ -0,0 +1,7 @@ +
+
+ {#processedValues} + {#view key="_textfield"/} {label} + {/processedValues} +
+
\ No newline at end of file diff --git a/platform/forms/src/MCTForm.js b/platform/forms/src/MCTForm.js new file mode 100644 index 0000000000..c0585d2a00 --- /dev/null +++ b/platform/forms/src/MCTForm.js @@ -0,0 +1,31 @@ +/*global define,Promise*/ + +/** + * Module defining MCTForm. Created by vwoeltje on 11/10/14. + */ +define( + [], + function () { + "use strict"; + + /** + * + * @constructor + */ + function MCTForm() { + var templatePath = [ + "platform/forms", //MCTForm.bundle.path, + "res", //MCTForm.bundle.resources, + "templates/form.html" + ].join("/"); + + return { + restrict: "E", + templateUrl: templatePath, + scope: { structure: "=", model: "=ngModel" } + }; + } + + return MCTForm; + } +); \ No newline at end of file