From 21545c3e7f8312e83e5398d3244ae9260d39fe54 Mon Sep 17 00:00:00 2001 From: Endi S. Dewata Date: Thu, 18 Nov 2010 23:53:14 -0600 Subject: [PATCH] Use radio buttons for HBAC rule type To be consistent with the details page, the rule type in the HBAC add dialog box has been converted into radio buttons. --- install/static/hbac.js | 8 ++++++-- install/static/widget.js | 30 +++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/install/static/hbac.js b/install/static/hbac.js index f63a489e06c1f5601934e2623cc64d048c41ee3c..894b2f4a01e0d00f162549a1d8a4def37d15b331 100755 --- a/install/static/hbac.js +++ b/install/static/hbac.js @@ -71,9 +71,13 @@ function ipa_hbac_add_dialog(spec) { 'undo': false })); - that.add_field(ipa_text_widget({ + that.add_field(ipa_radio_widget({ 'name': 'accessruletype', - 'label': 'Rule type (allow/deny)', + 'label': 'Rule type', + 'options': [ + { 'value': 'allow', 'label': 'Allow' }, + { 'value': 'deny', 'label': 'Deny' } + ], 'undo': false })); }; diff --git a/install/static/widget.js b/install/static/widget.js index f6bc3d837c1d8ebd1ec6c3aac8ff81b75cdb17f4..060f258eb0a516fe11069ed7f55e83b5deb37112 100755 --- a/install/static/widget.js +++ b/install/static/widget.js @@ -265,6 +265,31 @@ function ipa_radio_widget(spec) { var that = ipa_widget(spec); + that.options = spec.options; + + that.create = function(container) { + + for (var i=0; i', { + 'type': 'radio', + 'name': that.name, + 'value': option.value + }).appendTo(container); + + container.append(option.label); + } + + if (that.undo) { + $('', { + 'name': 'undo', + 'style': 'display: none;', + 'html': 'undo' + }).appendTo(container); + } + }; + that.setup = function(container) { that.widget_setup(container); @@ -295,7 +320,10 @@ function ipa_radio_widget(spec) { }; that.clear = function() { - $('input[name="'+that.name+'"]', that.container).get().checked = false; + $('input[name="'+that.name+'"]', that.container).each(function() { + var input = this; + input.checked = false; + }); }; return that; -- 1.6.6.1