From 5e7a1d46c0f49e0367f2141bfedc755552c7c0a2 Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Tue, 15 Dec 2015 08:34:36 -0500 Subject: Revised system to hide the automatically generated "Toggle all" button when not required. Original system broke with PR to change radio button names. --- src/usr/local/www/jquery/pfSense.js | 18 ++++++++---------- src/usr/local/www/jquery/pfSenseHelpers.js | 4 ++-- src/usr/local/www/status_logs_settings.php | 12 ++---------- 3 files changed, 12 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/jquery/pfSense.js b/src/usr/local/www/jquery/pfSense.js index a30b4b6..948d237 100644 --- a/src/usr/local/www/jquery/pfSense.js +++ b/src/usr/local/www/jquery/pfSense.js @@ -139,21 +139,19 @@ $(function() { } }); - // Add toggle-all when there are multiple checkboxes and none of them are radio buttons + // Add toggle-all when there are multiple checkboxes $('.control-label + .checkbox.multi').each(function() { var a = $('toggle all'); - if(($(this).html().indexOf("type=\"radio\"") == -1)) { - a.on('click', function() { - var wrap = $(this).parents('.form-group').find('.checkbox.multi'), - all = wrap.find('input[type=checkbox]'), - checked = wrap.find('input[type=checkbox]:checked'); + a.on('click', function() { + var wrap = $(this).parents('.form-group').find('.checkbox.multi'), + all = wrap.find('input[type=checkbox]'), + checked = wrap.find('input[type=checkbox]:checked'); - all.prop('checked', (all.length != checked.length)); - }); + all.prop('checked', (all.length != checked.length)); + }); - a.appendTo($(this)); - } + a.appendTo($(this)); }); // The need to NOT hide the advanced options if the elements therein are not set to the system diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js index 552f107..b183339 100644 --- a/src/usr/local/www/jquery/pfSenseHelpers.js +++ b/src/usr/local/www/jquery/pfSenseHelpers.js @@ -106,9 +106,9 @@ function hideSelect(id, hide) { function hideMultiCheckbox(id, hide) { if(hide) - $('#' + id).parent().addClass('hidden'); + $("[name=" + id + "]").parent().addClass('hidden'); else - $('#' + id).parent().removeClass('hidden'); + $("[name=" + id + "]").parent().removeClass('hidden'); } // Hides the
in which the specified IP address element lives so that the input, its label and help text are hidden diff --git a/src/usr/local/www/status_logs_settings.php b/src/usr/local/www/status_logs_settings.php index 95ba3b1..11cc1dc 100644 --- a/src/usr/local/www/status_logs_settings.php +++ b/src/usr/local/www/status_logs_settings.php @@ -462,14 +462,6 @@ $group->add(new Form_MultiCheckbox( $pconfig['hostapd'] )); -// Ugly hack to prevent the "Toggle all" button from being automatically created -$group->add(new Form_MultiCheckbox( - 'notoggleall', - null, - 'No toggle all', - $pconfig['hostapd'] -))->displayAsRadio(); - $group->setHelp('Syslog sends UDP datagrams to port 514 on the specified remote '. 'syslog server, unless another port is specified. Be sure to set syslogd on '. 'the remote server to accept syslog messages from pfSense.'); @@ -484,7 +476,8 @@ print $form; //