summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2013-04-16 13:13:38 +0200
committerPetr Vobornik <pvoborni@redhat.com>2013-05-06 16:22:26 +0200
commit9a23e5c9ec887790a604ff5667a223e58485291a (patch)
tree2a8c6e5152a6ad8b7e6a57e62507195b68d6119c
parente100ba7e2b14b74ed548ee0dd6ba1093b17dd795 (diff)
downloadfreeipa-9a23e5c9ec887790a604ff5667a223e58485291a.tar.gz
freeipa-9a23e5c9ec887790a604ff5667a223e58485291a.tar.xz
freeipa-9a23e5c9ec887790a604ff5667a223e58485291a.zip
Registry and builder for formatters
https://fedorahosted.org/freeipa/ticket/3235
-rw-r--r--install/ui/src/freeipa/field.js2
-rw-r--r--install/ui/src/freeipa/widget.js15
2 files changed, 14 insertions, 3 deletions
diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js
index 25576a93a..292f8881b 100644
--- a/install/ui/src/freeipa/field.js
+++ b/install/ui/src/freeipa/field.js
@@ -55,7 +55,7 @@ IPA.field = function(spec) {
that.label = text.get(spec.label);
that.tooltip = text.get(spec.tooltip);
that.measurement_unit = spec.measurement_unit;
- that.formatter = spec.formatter;
+ that.formatter = builder.build('formatter', spec.formatter);
that.widget = null;
that.widget_name = spec.widget;
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index 42f67d3b8..df497d6e9 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -1391,7 +1391,7 @@ IPA.column = function (spec) {
that.width = spec.width;
that.primary_key = spec.primary_key;
that.link = spec.link;
- that.formatter = spec.formatter;
+ that.formatter = builder.build('formatter', spec.formatter);
if (!that.entity) {
throw {
@@ -3945,7 +3945,7 @@ exp.post_op = function(obj, spec, context) {
return obj;
};
-// New builder and registry
+// Widget builder and registry
exp.builder = builder.get('widget');
exp.builder.factory = IPA.text_widget;
exp.builder.string_mode = 'property';
@@ -3955,8 +3955,15 @@ exp.builder.post_ops.push(exp.post_op);
reg.set('widget', exp.builder.registry);
+// Formatter builder and registry
+exp.formatter_builder = builder.get('formatter');
+exp.formatter_builder.factory = IPA.formatter;
+reg.set('formatter', exp.formatter_builder.registry);
+
+
exp.register = function() {
var w = reg.widget;
+ var f = reg.formatter;
w.register('attribute_table', IPA.attribute_table_widget);
w.register('button', IPA.button_widget);
@@ -3980,6 +3987,10 @@ exp.register = function() {
w.register('textarea', IPA.textarea_widget);
w.register('text', IPA.text_widget);
w.register('value_map', IPA.value_map_widget);
+
+ f.register('boolean', IPA.boolean_formatter);
+ f.register('boolean_status', IPA.boolean_status_formatter);
+ f.register('utc_date', IPA.utc_date_formatter);
};
phases.on('registration', exp.register);