diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-10-27 10:16:31 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-10-27 10:17:03 -0400 |
commit | 0bc61baaa862ad58171fcfde07be91db9245145c (patch) | |
tree | 9973f5f1968028506c94dac99859959b8e9ca954 /src/usr/local/www | |
parent | 1474131881232906c9200ccc2da38f6ea5c9c5f3 (diff) | |
download | pfsense-0bc61baaa862ad58171fcfde07be91db9245145c.zip pfsense-0bc61baaa862ad58171fcfde07be91db9245145c.tar.gz |
Javascript refine to hide Delete row button if there is only one row
Diffstat (limited to 'src/usr/local/www')
-rwxr-xr-x | src/usr/local/www/firewall_aliases_edit.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/jquery/pfSenseHelpers.js | 11 | ||||
-rw-r--r-- | src/usr/local/www/pkg_edit.php | 5 | ||||
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/services_ntpd.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/services_router_advertisements.php | 2 | ||||
-rw-r--r-- | src/usr/local/www/services_unbound_acls.php | 9 | ||||
-rw-r--r-- | src/usr/local/www/system_certmanager.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/vpn_pppoe_edit.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/widgets/widgets/wake_on_lan.widget.php | 8 |
10 files changed, 45 insertions, 5 deletions
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 3b9cfaf..8f3198b 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -810,6 +810,9 @@ events.push(function(){ // On load . . typechange(); + + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); // Autocomplete var addressarray = <?= json_encode(array_exclude($pconfig['name'], get_alias_list($pconfig['type']))) ?>; diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js index 0668489..2a1d123 100644 --- a/src/usr/local/www/jquery/pfSenseHelpers.js +++ b/src/usr/local/www/jquery/pfSenseHelpers.js @@ -240,6 +240,15 @@ function renumber() { function delete_row(row) { $('#' + row).parent('div').parent('div').remove(); renumber(); + checkLastRow(); +} + +function checkLastRow() { + if($('.repeatable').length <= 1) { + $('#deleterow0').hide(); + } else { + $('[id^=deleterow]').show(); + } } function add_row() { @@ -289,6 +298,8 @@ function add_row() { setMasks(); + checkLastRow(); + $('[id^=address]').autocomplete({ source: addressarray }); diff --git a/src/usr/local/www/pkg_edit.php b/src/usr/local/www/pkg_edit.php index ea04094..68886d7 100644 --- a/src/usr/local/www/pkg_edit.php +++ b/src/usr/local/www/pkg_edit.php @@ -1423,7 +1423,10 @@ if ($pkg['fields']['field'] != "") { ?> // Hide on page load $('.advancedoptions').hide(); - // But show it if you click the showadv button + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); + + // Show advanced section if you click the showadv button $('#showadv').prop('type', 'button'); $("#showadv").click(function() { diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index ca60cb4..a7446a8 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -1528,6 +1528,9 @@ events.push(function(){ show_advldap(); show_advboot(); show_advopts(); + + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); }); //]]> </script> diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php index 36af8b7..6b368a4 100644 --- a/src/usr/local/www/services_ntpd.php +++ b/src/usr/local/www/services_ntpd.php @@ -554,6 +554,9 @@ events.push(function(){ hideCheckbox('notrap', true); hideInput('leaptext', true); hideInput('leapfile', true); + + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); }); //]]> </script> diff --git a/src/usr/local/www/services_router_advertisements.php b/src/usr/local/www/services_router_advertisements.php index 8c001f9..05155a0 100644 --- a/src/usr/local/www/services_router_advertisements.php +++ b/src/usr/local/www/services_router_advertisements.php @@ -409,6 +409,8 @@ print($form); <script> //<![CDATA[ events.push(function(){ + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); // --------- Autocomplete ----------------------------------------------------------------------------------------- var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>; diff --git a/src/usr/local/www/services_unbound_acls.php b/src/usr/local/www/services_unbound_acls.php index a9d1076..e428c25 100644 --- a/src/usr/local/www/services_unbound_acls.php +++ b/src/usr/local/www/services_unbound_acls.php @@ -325,6 +325,15 @@ else // NOT 'edit' or 'add' </nav> </div> </div> + +<script> +//<![CDATA[ +events.push(function(){ + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); +}); +//]]> +</script> <?php } diff --git a/src/usr/local/www/system_certmanager.php b/src/usr/local/www/system_certmanager.php index 60d18aa..581cdd3 100644 --- a/src/usr/local/www/system_certmanager.php +++ b/src/usr/local/www/system_certmanager.php @@ -1096,6 +1096,9 @@ events.push(function(){ internalca_change(); + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); + <?php endif; ?> diff --git a/src/usr/local/www/vpn_pppoe_edit.php b/src/usr/local/www/vpn_pppoe_edit.php index d6540a5..1f146e6 100644 --- a/src/usr/local/www/vpn_pppoe_edit.php +++ b/src/usr/local/www/vpn_pppoe_edit.php @@ -625,6 +625,9 @@ events.push(function(){ hide_radius2(!$('#radiussecenable').prop('checked')); hide_radius(!$('#radiusenable').prop('checked')); + // Suppress "Delete row" button if there are fewer than two rows + checkLastRow(); + }); //]]> </script> diff --git a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php index 94698f3..60d6eaf 100644 --- a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php +++ b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php @@ -88,17 +88,17 @@ if (count($wolcomputers) > 0) { $status = exec("/usr/sbin/arp -an | /usr/bin/awk '$4 == \"{$wolent['mac']}\" { print $7 }'"); if ($status == 'expires') { echo '<td class="listr" align="center">' . "\n"; - echo "<i class="icon-large icon-arrow-right"></i> " . gettext("Online") . "</td>\n"; + echo '<i class="icon-large icon-arrow-right"></i> ' . gettext("Online") . "</td>\n"; } else if ($status == 'permanent') { echo '<td class="listr" align="center">' . "\n"; - echo "<i class="icon-large icon-arrow-right"></i> " . gettext("Static ARP") . "</td>\n"; + echo '<i class="icon-large icon-arrow-right"></i> ' . gettext("Static ARP") . "</td>\n"; } else { echo '<td class="listbg" align="center">' . "\n"; - echo "<i class="icon-large icon-ban-circle"></i> <font color=\"white\">" . gettext("Offline") . "</font></td>\n"; + echo '<i class="icon-large icon-ban-circle"></i> <font color="white">' . gettext("Offline") . "</font></td>\n"; } echo '<td valign="middle" class="list nowrap">'; echo "<a href='services_wol.php?mac={$wolent['mac']}&if={$wolent['interface']}'> "; - echo "<i class="icon-large icon-thumbs-up" alt="wol"></i></a>\n"; + echo '<i class="icon-large icon-thumbs-up" alt="wol"></i></a>' . "\n"; echo "</td></tr>\n"; } } else { |