added natural field
This commit is contained in:
parent
4be6210134
commit
6c671abd6b
|
@ -28,6 +28,7 @@ function validateFormFieldType(value) {
|
|||
'checkbox',
|
||||
'hidden',
|
||||
'yes_no',
|
||||
'natural'
|
||||
];
|
||||
|
||||
if (validTypes.indexOf(value) > -1) {
|
||||
|
|
|
@ -28,7 +28,8 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
|||
'legal',
|
||||
'statement',
|
||||
'rating',
|
||||
'yes_no'
|
||||
'yes_no',
|
||||
'natural'
|
||||
];
|
||||
if (__indexOf.call(supported_fields, type) >= 0) {
|
||||
return templateUrl += type + '.html';
|
||||
|
@ -48,6 +49,14 @@ angular.module('forms').directive('fieldDirective', function($http, $compile) {
|
|||
defaultDate: 0,
|
||||
};
|
||||
}
|
||||
//Set only if we have a natural lang processing field
|
||||
else if(scope.field.fieldType === 'natural'){
|
||||
|
||||
//Fires when field is changed
|
||||
scope.$watch('scope.field', function(newValue, oldValue) {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// GET template content from path
|
||||
var templateUrl = getTemplateUrl(scope.field);
|
||||
|
|
|
@ -29,6 +29,8 @@ angular.module('forms').directive('formDirective', ['$http', '$timeout', 'timeCo
|
|||
};
|
||||
|
||||
$scope.reloadForm = function(){
|
||||
timeCounter.stopClock();
|
||||
timeCounter.startClock();
|
||||
$scope.form.submitted = false;
|
||||
$scope.form.form_fields = _.chain($scope.form.form_fields).map(function(field){
|
||||
field.fieldValue = '';
|
||||
|
|
|
@ -63,6 +63,10 @@ angular.module('forms').service('FormFields', [
|
|||
name : 'statement',
|
||||
value : 'Statement'
|
||||
},
|
||||
{
|
||||
name : 'natural',
|
||||
value : 'Natural Language Input'
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
|
18
public/modules/forms/views/directiveViews/field/natural.html
Normal file
18
public/modules/forms/views/directiveViews/field/natural.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<div class="textfield natural field row">
|
||||
<div class="col-xs-12 field-title"><h3><span class="fa fa-angle-double-right"></span> {{field.title}} <span class="required-error" ng-show="field.required && !field.fieldValue">*(required)</span></h3></div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<input type="text"
|
||||
class="text-field-input"
|
||||
ng-model="field.fieldValue"
|
||||
ng-model-options="{ debounce: 250 }"
|
||||
value="field.fieldValue"
|
||||
ng-required="field.required"
|
||||
ng-disabled="field.disabled" changeFocus
|
||||
focus-up-id="focusUpButton"
|
||||
focus-down-id="focusDownButton">
|
||||
</div>
|
||||
<br>
|
||||
<div class="col-xs-12">
|
||||
<span ng-bind="field.fieldMatchValue"></span>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in a new issue