summaryrefslogtreecommitdiffstats
path: root/install/ui/widget.js
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2011-06-13 23:18:57 -0500
committerAdam Young <ayoung@redhat.com>2011-06-16 11:51:25 -0400
commitd6343f4bb079eec744553078c75205abec7e692d (patch)
treeef49a79fbfff427da1e086da15f59cd75f6f9b83 /install/ui/widget.js
parent724dd997447c84c6eb3893fe40fb2c5a78d4efd7 (diff)
downloadfreeipa-d6343f4bb079eec744553078c75205abec7e692d.tar.gz
freeipa-d6343f4bb079eec744553078c75205abec7e692d.tar.xz
freeipa-d6343f4bb079eec744553078c75205abec7e692d.zip
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
Diffstat (limited to 'install/ui/widget.js')
-rw-r--r--install/ui/widget.js34
1 files changed, 24 insertions, 10 deletions
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) {
+ $('<a/>', {
+ 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;
};