webui: add pwpolicy link to group details page if group has associated pwpolicy

https://fedorahosted.org/freeipa/ticket/4982

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Petr Vobornik 2015-04-17 17:56:58 +02:00
parent d1a0474d18
commit b61f4bc538
2 changed files with 24 additions and 11 deletions

View File

@ -68,7 +68,15 @@ return {
posixgroup: '@i18n:objects.group.posix'
}
},
'gidnumber'
'gidnumber',
{
$type: 'link',
name: 'pwpolicy',
param: 'cn',
label: '@mo:pwpolicy.label_singular',
other_entity: 'pwpolicy',
require_link: true
}
]
}
],

View File

@ -4143,6 +4143,12 @@ IPA.link_widget = function(spec) {
*/
that.no_check = spec.no_check;
/**
* Whether value can be displayed even if link is not valid.
* @property {boolean}
*/
that.require_link = spec.require_link !== undefined ? spec.require_link : false;
that.value = '';
that.values = [];
@ -4182,18 +4188,17 @@ IPA.link_widget = function(spec) {
};
that.update_link = function() {
var link = false;
var nonlink = false;
if (that.value) {
if(that.is_link) {
that.link.css('display','');
that.nonlink.css('display','none');
} else {
that.link.css('display','none');
that.nonlink.css('display','');
}
} else {
that.link.css('display','none');
that.nonlink.css('display','none');
link = !!that.is_link;
nonlink = !that.is_link && !that.require_link;
}
that.link.css('display', link ? '' : 'none');
that.nonlink.css('display', nonlink ? '' : 'none');
};
/**