From 9dc8e26b735c7ad6b9ed2277a95c8745edfc7f40 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 11 Apr 2013 15:44:40 +0200 Subject: Rename factory to $factory in spec objects modifications https://fedorahosted.org/freeipa/ticket/3235 --- install/ui/src/freeipa/association.js | 2 +- install/ui/src/freeipa/details.js | 8 ++++---- install/ui/src/freeipa/dialog.js | 2 +- install/ui/src/freeipa/dns.js | 2 +- install/ui/src/freeipa/entity.js | 12 ++++++------ install/ui/src/freeipa/facet.js | 24 ++++++++++++------------ install/ui/src/freeipa/field.js | 4 ++-- install/ui/src/freeipa/widget.js | 12 ++++++------ install/ui/test/utils_tests.js | 2 +- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js index 8cbdc63af..505cbbfd1 100644 --- a/install/ui/src/freeipa/association.js +++ b/install/ui/src/freeipa/association.js @@ -842,7 +842,7 @@ IPA.association_facet = function (spec, no_init) { var column; var factory; if (spec instanceof Object) { - factory = spec.factory || IPA.column; + factory = spec.$factory || IPA.column; } else { factory = IPA.column; spec = { name: spec }; diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js index 19dfa1b67..dffa187e9 100644 --- a/install/ui/src/freeipa/details.js +++ b/install/ui/src/freeipa/details.js @@ -133,8 +133,8 @@ exp.section_builder = IPA.section_builder = function(spec) { if(!section_spec.name) section_spec.name = 'section'+index; - section_spec.factory = section_spec.factory || that.section_factory; - var section = section_spec.factory(section_spec); + section_spec.$factory = section_spec.$factory || that.section_factory; + var section = section_spec.$factory(section_spec); that.container.widgets.add_widget(section); @@ -152,8 +152,8 @@ exp.section_builder = IPA.section_builder = function(spec) { var widget = that.widget_builder.build_widget(field_spec, section.widgets); - //spec.factory refers to widget factory - if(field_spec.factory) delete field_spec.factory; + //spec.$factory refers to widget factory + if(field_spec.$factory) delete field_spec.$factory; var field = that.field_builder.build_field(field_spec, that.container.fields); diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index 2316df56b..2243c5ac0 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -111,7 +111,7 @@ IPA.dialog = function(spec) { }); that.create_button = function(spec) { - var factory = spec.factory || IPA.dialog_button; + var factory = spec.$factory || IPA.dialog_button; var button = factory(spec); that.add_button(button); return button; diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js index 4c135ff6e..47902b1b4 100644 --- a/install/ui/src/freeipa/dns.js +++ b/install/ui/src/freeipa/dns.js @@ -1684,7 +1684,7 @@ IPA.dns.record_type_table_widget = function(spec) { spec.entity = that.entity; spec.label = spec.label || IPA.dns.record_get_attr_label(spec.name); - var factory = spec.factory || IPA.column; + var factory = spec.$factory || IPA.column; var column = factory(spec); that.add_column(column); diff --git a/install/ui/src/freeipa/entity.js b/install/ui/src/freeipa/entity.js index 8831fa70c..2470ac3f7 100644 --- a/install/ui/src/freeipa/entity.js +++ b/install/ui/src/freeipa/entity.js @@ -182,7 +182,7 @@ IPA.entity_builder = function() { that.entity = function(spec) { var factory = IPA.entity; if (spec instanceof Object) { - factory = spec.factory || IPA.entity; + factory = spec.$factory || IPA.entity; } else { spec = { name: spec }; } @@ -203,7 +203,7 @@ IPA.entity_builder = function() { that.facet_group = function(spec) { spec.entity = entity; if (spec instanceof Object) { - var factory = spec.factory || IPA.facet_group; + var factory = spec.$factory || IPA.facet_group; facet_group = factory(spec); } else { facet_group = IPA.facet_group({ name: spec }); @@ -378,7 +378,7 @@ IPA.entity_builder = function() { that.dialog = function(spec) { if (spec instanceof Object) { - spec.factory = spec.factory || IPA.dialog; + spec.$factory = spec.$factory || IPA.dialog; spec.entity = entity; } else { @@ -394,7 +394,7 @@ IPA.entity_builder = function() { }; that.adder_dialog = function(spec) { - spec.factory = spec.factory || IPA.entity_adder_dialog; + spec.$factory = spec.$factory || IPA.entity_adder_dialog; spec.name = spec.name || 'add'; if (!spec.title) { @@ -407,7 +407,7 @@ IPA.entity_builder = function() { }; that.deleter_dialog = function(spec) { - spec.factory = spec.factory || IPA.search_deleter_dialog; + spec.$factory = spec.$factory || IPA.search_deleter_dialog; spec.name = spec.name || 'remove'; return that.dialog(spec); @@ -439,7 +439,7 @@ IPA.dialog_builder = function(entity) { spec.entity = entity; //add dialog - var dialog = spec.factory(spec); + var dialog = spec.$factory(spec); entity.dialog(dialog); }; diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index 6edae5d05..958941291 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -1109,7 +1109,7 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) { that.create_column = function(spec) { var column; if (spec instanceof Object) { - var factory = spec.factory || IPA.column; + var factory = spec.$factory || IPA.column; } else { factory = IPA.column; spec = { name: spec }; @@ -1502,7 +1502,7 @@ exp.facet_builder = IPA.facet_builder = function(entity) { } //add facet - var facet = spec.factory(spec); + var facet = spec.$factory(spec); entity.add_facet(facet); }; @@ -1519,7 +1519,7 @@ exp.facet_builder = IPA.facet_builder = function(entity) { spec.title = spec.title || entity.metadata.label; spec.label = spec.label || entity.metadata.label; spec.tab_label = spec.tab_label || '@i18n:facets.search'; - spec.factory = spec.factory || IPA.search_facet; + spec.$factory = spec.$factory || IPA.search_facet; add_redirect_info(); return spec; @@ -1530,7 +1530,7 @@ exp.facet_builder = IPA.facet_builder = function(entity) { spec.title = spec.title || entity.metadata.label_singular; spec.label = spec.label || entity.metadata.label; spec.tab_label = spec.tab_label || '@i18n:facets.search'; - spec.factory = spec.factory || IPA.nested_search_facet; + spec.$factory = spec.$factory || IPA.nested_search_facet; return spec; }; @@ -1539,7 +1539,7 @@ exp.facet_builder = IPA.facet_builder = function(entity) { spec.title = spec.title || entity.metadata.label_singular; spec.label = spec.label || entity.metadata.label_singular; spec.tab_label = spec.tab_label || '@i18n:facets.details'; - spec.factory = spec.factory || IPA.details_facet; + spec.$factory = spec.$factory || IPA.details_facet; return spec; }; @@ -1550,7 +1550,7 @@ exp.facet_builder = IPA.facet_builder = function(entity) { var attr_metadata = IPA.get_entity_param(entity.name, spec.attribute); spec.tab_label = spec.tab_label || attr_metadata.label; - spec.factory = spec.factory || IPA.attribute_facet; + spec.$factory = spec.$factory || IPA.attribute_facet; entity.policies.add_policy(IPA.build({ $factory: IPA.facet_update_policy, @@ -1576,7 +1576,7 @@ exp.facet_builder = IPA.facet_builder = function(entity) { spec.facet_group = spec.facet_group || spec.attribute_member; - spec.factory = spec.factory || IPA.association_facet; + spec.$factory = spec.$factory || IPA.association_facet; spec.label = spec.label || entity.metadata.label_singular; spec.tab_label = spec.tab_label || @@ -2423,23 +2423,23 @@ var FacetState = exp.FacetState = declare([Stateful, Evented], { }); exp.action_builder = IPA.action_builder = new Builder({ - $factory: exp.action + factory: exp.action }); exp.action_holder_builder = new Builder({ - $factory: exp.action_holder + factory: exp.action_holder }); exp.state_builder = IPA.state_builder = new Builder({ - $factory: exp.state + factory: exp.state }); exp.state_evaluator_builder = IPA.state_evaluator_builder = new Builder({ - $factory: exp.state + factory: exp.state }); exp.action_button_widget_builder = IPA.action_button_widget_builder = new Builder({ - $factory: exp.action_button_widget + factory: exp.action_button_widget }); return exp; diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index 6b2f41c4c..0ba823d12 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -875,8 +875,8 @@ IPA.field_builder = function(spec) { that.get_field_factory = function(spec) { var factory; - if (spec.factory) { - factory = spec.factory; + if (spec.$factory) { + factory = spec.$factory; } else if(spec.type) { factory = IPA.field_factories[spec.type]; } diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 88fd3e352..fc01bc082 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -730,8 +730,8 @@ IPA.option_widget_base = function(spec, that) { value: option }; } else { - if (option.type || option.factory) { - var factory = option.factory || IPA.widget_factories[option.type]; + if (option.type || option.$factory) { + var factory = option.$factory || IPA.widget_factories[option.type]; if (typeof factory !== 'function') throw { error: 'Invalid factory', $factory: factory @@ -1995,7 +1995,7 @@ IPA.attribute_table_widget = function(spec) { spec.entity = that.entity; - var factory = spec.factory || IPA.column; + var factory = spec.$factory || IPA.column; var column = factory(spec); that.add_column(column); @@ -2215,7 +2215,7 @@ IPA.attribute_table_widget = function(spec) { dialog_spec.title = dialog_spec.title.replace('${pkey}', pkey); - var factory = dialog_spec.factory || IPA.entity_adder_dialog; + var factory = dialog_spec.$factory || IPA.entity_adder_dialog; var dialog = factory(dialog_spec); var cancel_button = dialog.buttons.get('cancel'); @@ -3532,8 +3532,8 @@ IPA.widget_builder = function(spec) { that.get_widget_factory = function(spec) { var factory; - if (spec.factory) { - factory = spec.factory; + if (spec.$factory) { + factory = spec.$factory; } else if(spec.type) { factory = IPA.widget_factories[spec.type]; } diff --git a/install/ui/test/utils_tests.js b/install/ui/test/utils_tests.js index c93b89c39..2bef58459 100644 --- a/install/ui/test/utils_tests.js +++ b/install/ui/test/utils_tests.js @@ -49,7 +49,7 @@ test('Testing metadata validator', function() { // using strings as values because it is an output of inputs var validator = IPA.build({ - factory: IPA.metadata_validator + $factory: IPA.metadata_validator }); var metadata = { -- cgit