From d6343f4bb079eec744553078c75205abec7e692d Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 13 Jun 2011 23:18:57 -0500 Subject: Fixed self-service links. In self-service mode the user's association facets have been modified such that the entries are not linked since the only available entity is the user entity. A 'link' parameter has been added to IPA.association_facet and IPA.column to control whether to link the entries. The link_handler() method can be used to define how to handle the link. Ticket #1072 --- install/ui/widget.js | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'install/ui/widget.js') diff --git a/install/ui/widget.js b/install/ui/widget.js index 1af9fd839..3e31b4c4a 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -1014,39 +1014,53 @@ IPA.column = function (spec) { that.name = spec.name; that.label = spec.label; - that.primary_key = spec.primary_key; that.width = spec.width; + that.entity_name = spec.entity_name; - that.format = spec.format; + that.primary_key = spec.primary_key; + that.link = spec.link; - that.setup = spec.setup || setup; + that.format = spec.format; that.init = function() { if (that.entity_name && !that.label) { var param_info = IPA.get_entity_param(that.entity_name, that.name); if (param_info) { that.label = param_info.label; - }else{ + } else { alert('cannot find label for ' + that.entity_name + ' ' + that.name); } } }; - function setup(container, record) { - + that.setup = function(container, record) { container.empty(); var value = record[that.name]; - if (that.format && value){ + if (that.format && value) { value = that.format(value); } - value = value ? value.toString() : ''; + if (that.link) { + $('', { + href: '#'+value, + html: value, + click: function() { + return that.link_handler(value); + } + }).appendTo(container); + + } else { + container.append(value); + } + + }; - container.append(value); - } + that.link_handler = function(value) { + return false; + }; return that; }; -- cgit