diff --git a/platform/forms/bundle.json b/platform/forms/bundle.json index 2954a8eeea..5654d80f2b 100644 --- a/platform/forms/bundle.json +++ b/platform/forms/bundle.json @@ -40,6 +40,10 @@ "key": "DateTimeController", "implementation": "controllers/DateTimeController.js", "depends": [ "$scope" ] + }, + { + "key": "CompositeController", + "implementation": "controllers/CompositeController.js" } ], "templates": [ diff --git a/platform/forms/res/templates/controls/composite.html b/platform/forms/res/templates/controls/composite.html index 7b1585a48a..f6a4d9f46a 100644 --- a/platform/forms/res/templates/controls/composite.html +++ b/platform/forms/res/templates/controls/composite.html @@ -1,13 +1,15 @@ - - - - - {{item.name}} - - \ No newline at end of file + + + + + + {{item.name}} + + + \ No newline at end of file diff --git a/platform/forms/src/controllers/CompositeController.js b/platform/forms/src/controllers/CompositeController.js new file mode 100644 index 0000000000..2e91118fb5 --- /dev/null +++ b/platform/forms/src/controllers/CompositeController.js @@ -0,0 +1,27 @@ +/*global define*/ + +define( + [], + function () { + "use strict"; + + function CompositeController() { + function isDefined(element) { + return typeof element !== 'undefined'; + } + + function or(a, b) { + return a || b; + } + + return { + isNonEmpty: function (value) { + return (value || []).map(isDefined).reduce(or, false); + } + }; + } + + return CompositeController; + + } +); \ No newline at end of file