diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-12-15 08:34:36 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-15 08:34:36 -0500 |
commit | 5e7a1d46c0f49e0367f2141bfedc755552c7c0a2 (patch) | |
tree | ad64848edf891b7d8ab758c9fd6390346c3a1e15 /src | |
parent | f893557553d139d90b4c7c10c877da99a729dac5 (diff) | |
download | pfsense-5e7a1d46c0f49e0367f2141bfedc755552c7c0a2.zip pfsense-5e7a1d46c0f49e0367f2141bfedc755552c7c0a2.tar.gz |
Revised system to hide the automatically generated "Toggle all" button when not required.
Original system broke with PR to change radio button names.
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/jquery/pfSense.js | 18 | ||||
-rw-r--r-- | src/usr/local/www/jquery/pfSenseHelpers.js | 4 | ||||
-rw-r--r-- | src/usr/local/www/status_logs_settings.php | 12 |
3 files changed, 12 insertions, 22 deletions
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 = $('<a name="btntoggleall" class="btn btn-xs btn-default">toggle all</a>'); - 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 <div> 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; //<![CDATA[ events.push(function() { - hideMultiCheckbox('notoggleall', true); + // We don't want to see the automatically generated "Toggle all" button + $('[name=btntoggleall]').hide(); // ---------- Click checkbox handlers --------------------------------------------------------- @@ -496,7 +489,6 @@ events.push(function() { hideClass('remotelogging', !this.checked); hideSelect('sourceip', !this.checked); hideSelect('ipproto', !this.checked); - hideMultiCheckbox('notoggleall', true); }); function disableEverything() { |