GUAC-1176: Generalize form fields by removing the value property. Add type-specific convenience classes for each field.

This commit is contained in:
Michael Jumper
2015-06-08 10:14:10 -07:00
parent 0b8b67026a
commit a532e22926
16 changed files with 452 additions and 106 deletions

View File

@@ -29,12 +29,12 @@ angular.module('form').controller('checkboxFieldController', ['$scope',
// Update typed value when model is changed
$scope.$watch('model', function modelChanged(model) {
$scope.typedValue = (model === $scope.field.value);
$scope.typedValue = (model === $scope.field.options[0].value);
});
// Update string value in model when typed value is changed
$scope.$watch('typedValue', function typedValueChanged(typedValue) {
$scope.model = (typedValue ? $scope.field.value : '');
$scope.model = (typedValue ? $scope.field.options[0].value : '');
});
}]);

View File

@@ -64,16 +64,7 @@ angular.module('rest').factory('Field', [function defineField() {
this.type = template.type || Field.Type.TEXT;
/**
* The value to set the parameter to, in the case of a BOOLEAN
* parameter, to enable that parameter's effect.
*
* @type String
*/
this.value = template.value;
/**
* All possible legal values for this parameter. This property is only
* applicable to ENUM type parameters.
* All possible legal values for this parameter.
*
* @type FieldOption[]
*/
@@ -123,7 +114,9 @@ angular.module('rest').factory('Field', [function defineField() {
/**
* The type string associated with parameters that may contain only a
* single possible value, where that value enables the parameter's
* effect.
* effect. It is assumed that each BOOLEAN field will provide exactly
* one possible value (option), which will be the value if that field
* is true.
*
* @type String
*/