From 5d2b0fecd57b18b647ff9f243196cf98ead2d9fd Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 2 Aug 2012 17:37:12 +0200 Subject: Attribute facet Created new type of facet: attribute facet. This facet is similar to association facet but it serves for displaying object's multivalued attributes which behaves like association attributes. It will serve as a basis for displaying group's externalmember attribute. https://fedorahosted.org/freeipa/ticket/2895 --- install/ui/facet.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'install/ui/facet.js') diff --git a/install/ui/facet.js b/install/ui/facet.js index 3f6d559e..267fc333 100644 --- a/install/ui/facet.js +++ b/install/ui/facet.js @@ -747,6 +747,8 @@ IPA.table_facet = function(spec, no_init) { that.row_disabled_attribute = spec.row_disabled_attribute; that.details_facet_name = spec.details_facet || 'default'; + that.table_name = spec.table_name; + that.columns = $.ordered_map(); that.get_columns = function() { @@ -1003,7 +1005,7 @@ IPA.table_facet = function(spec, no_init) { that.table = IPA.table_widget({ 'class': 'content-table', - name: entity.metadata.primary_key, + name: that.table_name || entity.metadata.primary_key, label: entity.metadata.label, entity: entity, pagination: true, @@ -1125,6 +1127,7 @@ IPA.facet_builder = function(entity) { that.prepare_methods.nested_search = that.prepare_nested_search_spec; that.prepare_methods.details = that.prepare_details_spec; that.prepare_methods.association = that.prepare_association_spec; + that.prepare_methods.attribute = that.prepare_attribute_spec; } that.build_facets = function() { @@ -1195,6 +1198,17 @@ IPA.facet_builder = function(entity) { return spec; }; + that.prepare_attribute_spec = function(spec) { + spec.title = spec.title || entity.metadata.label_singular; + spec.label = spec.label || entity.metadata.label_singular; + + 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; + + return spec; + }; + that.prepare_association_spec = function(spec) { spec.entity = entity; -- cgit