Refactored builder interface.

The IPA.entity_builder has been modified to take a 'factory' parameter
in custom facet's and custom dialog's spec. The IPA.dialog has been
modified to take an array of fields in the spec. The IPA.search_facet
has been modified to take an array of columns in the spec.
This commit is contained in:
Endi S. Dewata
2011-04-07 16:14:58 -05:00
committed by Endi Sukma Dewata
parent f0f83a862e
commit 689fd30b52
9 changed files with 103 additions and 68 deletions

View File

@@ -265,6 +265,25 @@ IPA.dialog = function(spec) {
that.dialog_setup = that.setup;
that.dialog_open = that.open;
var fields = spec.fields || [];
for (var i=0; i<fields.length; i++) {
var field_spec = fields[i];
var field;
if (field_spec instanceof Object) {
if (field_spec.factory) {
field = field_spec.factory(field_spec);
} else {
field = IPA.text_widget(field_spec);
}
} else {
var field_name = field_spec;
field = IPA.text_widget({ name: field_name, undo: false });
}
that.add_field(field);
}
return that;
};