mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
New checkboxes option: Mutual exclusive
Problem: UI doesn't have a control for selecting one or none value from given set of values. Solution: Attribute mutex was added to checkboxes_widget. When it is set, checking some value causes that all other values are unchecked. https://fedorahosted.org/freeipa/ticket/2351
This commit is contained in:
parent
a66d8d51b6
commit
7c392cb9a8
@ -665,6 +665,7 @@ IPA.checkboxes_widget = function (spec) {
|
||||
|
||||
that.options = spec.options || [];
|
||||
that.direction = spec.direction || 'vertical';
|
||||
that.mutex = spec.mutex;
|
||||
|
||||
that.create = function(container) {
|
||||
|
||||
@ -699,6 +700,15 @@ IPA.checkboxes_widget = function (spec) {
|
||||
|
||||
var input = $('input[name="'+that.name+'"]', that.container);
|
||||
input.change(function() {
|
||||
|
||||
var checkbox = $(this);
|
||||
var checked = checkbox.is(':checked');
|
||||
|
||||
if (that.mutex && checked) {
|
||||
that.clear();
|
||||
checkbox.attr('checked', true);
|
||||
}
|
||||
|
||||
that.value_changed.notify([that.save()], that);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user