Added test:ci script
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/form.component.js b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/form.component.js
index 4f22f99..4d53a92 100644
--- a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/form.component.js
+++ b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/form.component.js
@@ -61,13 +61,28 @@
ngModel: '='
},
template: `
- <ng-form name="vm.config.formName || 'form'">
+ <ng-form name="vm.{{vm.config.formName || 'form'}}">
<div class="form-group" ng-repeat="(name, field) in vm.formField">
<label>{{field.label}}</label>
- <input type="{{field.type}}" name="{{name}}" class="form-control" ng-model="vm.ngModel[name]"/>
+ <input ng-if="field.type !== 'boolean'" type="{{field.type}}" name="{{name}}" class="form-control" ng-model="vm.ngModel[name]"/>
+ <span class="boolean-field" ng-if="field.type === 'boolean'">
+ <button
+ class="btn btn-success"
+ ng-show="vm.ngModel[name]"
+ ng-click="vm.ngModel[name] = false">
+ <i class="glyphicon glyphicon-ok"></i>
+ </button>
+ <button
+ class="btn btn-danger"
+ ng-show="!vm.ngModel[name]"
+ ng-click="vm.ngModel[name] = true">
+ <i class="glyphicon glyphicon-remove"></i>
+ </button>
+ </span>
+ <xos-validation errors="vm[vm.config.formName || 'form'][name].$error"></xos-validation>
</div>
<div class="form-group" ng-if="vm.config.actions">
- <button href=""
+ <button role="button" href=""
ng-repeat="action in vm.config.actions"
ng-click="action.cb(vm.ngModel)"
class="btn btn-{{action.class}}"
@@ -152,6 +167,10 @@
model[f] = new Date(model[f]);
}
+ if(form[f].type === 'number'){
+ model[f] = parseInt(model[f], 10);
+ }
+
return form;
}, {});
};
diff --git a/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/validation.component.js b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/validation.component.js
new file mode 100644
index 0000000..6b80a32
--- /dev/null
+++ b/views/ngXosLib/xosHelpers/src/ui_components/dumbComponents/validation.component.js
@@ -0,0 +1,48 @@
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 4/15/16.
+ */
+
+(function () {
+ 'use strict';
+
+ angular.module('xos.uiComponents')
+
+ /**
+ * @ngdoc directive
+ * @name xos.uiComponents.directive:xosValidation
+ * @restrict E
+ * @description The xos-validation directive
+ * @param {Object} errors The error object
+ * @element ANY
+ * @scope
+ */
+
+ .directive('xosValidation', function(){
+ return {
+ restrict: 'E',
+ scope: {
+ errors: '='
+ },
+ template: `
+ <div>
+ <pre>{{vm.errors.email | json}}</pre>
+ <xos-alert config="vm.config" show="vm.errors.email !== undefined">
+ This is not a valid email
+ </xos-alert>
+ </div>
+ `,
+ transclude: true,
+ bindToController: true,
+ controllerAs: 'vm',
+ controller: function(){
+ this.config = {
+ type: 'danger'
+ }
+ }
+ }
+ })
+})();