summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Voborník <pvoborni@redhat.com>2012-02-10 11:25:41 +0100
committerPetr Vobornik <pvoborni@redhat.com>2012-02-29 12:59:13 +0100
commit7c392cb9a85e1534bd1133c4e0c9c3831058b4e7 (patch)
treed521bf494ba129c48657856059cc9524e9f68f8b /install
parenta66d8d51b6771e963da362fe6c45a75fcf148764 (diff)
downloadfreeipa-7c392cb9a85e1534bd1133c4e0c9c3831058b4e7.tar.gz
freeipa-7c392cb9a85e1534bd1133c4e0c9c3831058b4e7.tar.xz
freeipa-7c392cb9a85e1534bd1133c4e0c9c3831058b4e7.zip
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
Diffstat (limited to 'install')
-rw-r--r--install/ui/widget.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 3201dad7a..cc5f4f78e 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -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);
});