summaryrefslogtreecommitdiffstats
path: root/install/ui/src/freeipa/field.js
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2013-04-16 15:25:15 +0200
committerPetr Vobornik <pvoborni@redhat.com>2013-05-06 16:22:27 +0200
commit799bb24931f97be849eea48c6497adcd239e287c (patch)
tree54c2e13c5a6954e45752f94a04747bf88b582406 /install/ui/src/freeipa/field.js
parent511452ec41d7427fd284233ac39a50072d0ece55 (diff)
downloadfreeipa-799bb24931f97be849eea48c6497adcd239e287c.tar.gz
freeipa-799bb24931f97be849eea48c6497adcd239e287c.tar.xz
freeipa-799bb24931f97be849eea48c6497adcd239e287c.zip
Builder and registry for validators
https://fedorahosted.org/freeipa/ticket/3235
Diffstat (limited to 'install/ui/src/freeipa/field.js')
-rw-r--r--install/ui/src/freeipa/field.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js
index 292f8881b..6d05a256f 100644
--- a/install/ui/src/freeipa/field.js
+++ b/install/ui/src/freeipa/field.js
@@ -75,7 +75,7 @@ IPA.field = function(spec) {
that.undo = spec.undo === undefined ? true : spec.undo;
that.metadata = spec.metadata;
- that.validators = spec.validators || [];
+ that.validators = builder.build('validator', spec.validators) || [];
that.priority = spec.priority;
@@ -914,7 +914,7 @@ exp.post_op = function(obj, spec, context) {
return obj;
};
-// New builder and registry
+// Field builder and registry
exp.builder = builder.get('field');
exp.builder.factory = IPA.field;
exp.builder.string_mode = 'property';
@@ -923,8 +923,14 @@ reg.set('field', exp.builder.registry);
exp.builder.pre_ops.push(exp.pre_op);
exp.builder.post_ops.push(exp.post_op);
+// Validator builder and registry
+exp.validator_builder = builder.get('validator');
+//exp.validator_builder.factory = IPA.formatter;
+reg.set('validator', exp.validator_builder.registry);
+
exp.register = function() {
var f = reg.field;
+ var v = reg.validator;
f.register('checkbox', IPA.checkbox_field);
f.register('checkboxes', IPA.checkboxes_field);
@@ -941,6 +947,10 @@ exp.register = function() {
f.register('textarea', IPA.field);
f.register('text', IPA.field);
f.register('value_map', IPA.field);
+
+ v.register('metadata', IPA.metadata_validator);
+ v.register('unsupported', IPA.unsupported_validator);
+ v.register('same_password', IPA.same_password_validator);
};
phases.on('registration', exp.register);