From 2f2c67cb59f1a797e6f2e0b033cb480489c0df0b Mon Sep 17 00:00:00 2001 From: Pavel Zuna Date: Tue, 4 Jan 2011 15:21:18 -0500 Subject: Improvements to enrollments in the webUI. TAKE 1 - Enrollement links in the action panel are now sorted by relationships. - You can only enroll members. (The webUI made the impression you can enroll parents as well, but it was broken.) - When enrolling new members, you can choose not to display already enrolled ones. (On by default.) - Couple cosmetic changes. --- install/static/entity.js | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'install/static/entity.js') diff --git a/install/static/entity.js b/install/static/entity.js index 76f1c0d5..8620ef09 100644 --- a/install/static/entity.js +++ b/install/static/entity.js @@ -137,7 +137,7 @@ function ipa_entity(spec) { return config; }; - that.create_association_facet = function(attribute_member, other_entity, label) { + that.create_association_facet = function(attribute_member, other_entity, label, facet_group) { if (!attribute_member) { attribute_member = ipa_get_member_attribute( @@ -148,7 +148,9 @@ function ipa_entity(spec) { return ipa_association_facet({ 'name': attribute_member+'_'+other_entity, 'label': label, - 'other_entity': other_entity + 'other_entity': other_entity, + 'facet_group': facet_group, + 'attribute_member': attribute_member, }); }; @@ -170,18 +172,19 @@ function ipa_entity(spec) { var label = other_entity_name; - if (attribute_member.match(/^memberof$/)) { - label = IPA.messages.association.membershipin+' '+other_entity_name; + var relationships = IPA.metadata[that.name].relationships; - } else if (attribute_member.match(/^member/)) { - label = other_entity_name+' '+IPA.messages.association.members; + var relationship = relationships[attribute_member]; + if (!relationship) + relationship = ['Member', '', 'no_']; + var facet_group = relationship[0]; - } else if (attribute_member.match(/^managedby$/)) { - label = IPA.messages.association.managedby+' '+other_entity_name; - } + var facet = that.create_association_facet( + attribute_member, other_entity, label, facet_group + ); - var facet = that.create_association_facet(attribute_member, other_entity, label); if (that.get_facet(facet.name)) continue; + that.add_facet(facet); } } @@ -488,10 +491,30 @@ function ipa_facet_create_action_panel(container) { main_facet.appendTo(ul); ul.append($('
  • ')); + var facet_groups = {}; for (var i=1; i', { + 'class': 'entity-facet-relation-label', + 'text': other_facet.facet_group, + 'title': other_facet.facet_group, + }) + ul.append(li); + facet_groups[facet_group] = li; + } + var li = facet_groups[facet_group]; + li.after( + build_link(other_facet, other_facet.label) + ); + facet_groups[facet_group] = li.next(); + } else { + ul.append(build_link(other_facet, other_facet.label)); + } } }else{ $('
  • ', { -- cgit