diff options
author | Endi S. Dewata <edewata@redhat.com> | 2010-10-01 12:53:13 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2010-10-01 16:17:51 -0400 |
commit | aa7ecb6f5ff234fa9001bbea3ebe2e5360656139 (patch) | |
tree | 8c9957db5803b46daefe12c2889a470f2f83f564 /install/static/entity.js | |
parent | 38490d35d3b8410a8077fb035b57cea86dd3bdab (diff) | |
download | freeipa-aa7ecb6f5ff234fa9001bbea3ebe2e5360656139.tar.gz freeipa-aa7ecb6f5ff234fa9001bbea3ebe2e5360656139.tar.xz freeipa-aa7ecb6f5ff234fa9001bbea3ebe2e5360656139.zip |
Autogenerating Quick Links.
ipa_entity_quick_links() has been added to generate quick links
automatically from object's attribute_members, the same logic used
for generating facet list. The search definition for each entity
has been updated to use the new function. A unit test has been
added for this function.
Diffstat (limited to 'install/static/entity.js')
-rw-r--r-- | install/static/entity.js | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/install/static/entity.js b/install/static/entity.js index 39836fe3..5be67a39 100644 --- a/install/static/entity.js +++ b/install/static/entity.js @@ -202,3 +202,50 @@ function ipa_entity_generate_views(obj_name, container, switch_view) container.append(ul); } + +function ipa_entity_quick_links(tr, attr, value, entry_attrs) { + + var obj_name = tr.closest('.search-container').attr('title'); + var pkey = ipa_objs[obj_name].primary_key; + var pkey_value = entry_attrs[pkey][0]; + + var td = $("<td/>"); + tr.append(td); + + $("<a/>", { + href: "#details", + click: function() { + var state = {}; + state[obj_name+'-facet'] = 'details'; + state[obj_name+'-pkey'] = pkey_value; + nav_push_state(state); + return false; + } + }).append($('<img/>', { + src: obj_name+'_details.png' + })).appendTo(td); + + var attribute_members = ipa_objs[obj_name].attribute_members; + for (attr_name in attribute_members) { + var objs = attribute_members[attr_name]; + for (var i = 0; i < objs.length; ++i) { + var m = objs[i]; + + $("<a/>", { + href: '#'+m, + click: function(m) { + return function() { + var state = {}; + state[obj_name+'-facet'] = 'associate'; + state[obj_name+'-enroll'] = m; + state[obj_name+'-pkey'] = pkey_value; + nav_push_state(state); + return false; + } + }(m) + }).append($('<img/>', { + src: m+'_member.png' + })).appendTo(td); + } + } +} |