summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/index.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2017-03-19 11:21:31 +0545
committerPhil Davis <phil.davis@inf.org>2017-03-19 11:21:31 +0545
commitfba53b438540eb544c43adf4598e07320a910347 (patch)
treeaf60a3e9fdd909df7fed16379bb8e3de29e4bb3d /src/usr/local/www/index.php
parent405dfaad144de90a6e401354b80b82baf5ae3d59 (diff)
downloadpfsense-fba53b438540eb544c43adf4598e07320a910347.zip
pfsense-fba53b438540eb544c43adf4598e07320a910347.tar.gz
Redmine #7318 None button for widget filters
Diffstat (limited to 'src/usr/local/www/index.php')
-rw-r--r--src/usr/local/www/index.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index cfd4578..2b74a9e 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -445,6 +445,53 @@ function updateWidgets(newWidget) {
$('input[name=sequence]', $('#widgetSequence_form')).val(sequence);
}
+// Determine if all the checkboxes are checked
+function are_all_checked(checkbox_panel_ref) {
+ var allBoxesChecked = true;
+ $(checkbox_panel_ref).each(function() {
+ if ((this.type == 'checkbox') && !this.checked) {
+ allBoxesChecked = false;
+ }
+ });
+ return allBoxesChecked;
+}
+
+// If the checkboxes are all checked, then clear them all.
+// Otherwise set them all.
+function set_clear_checkboxes(checkbox_panel_ref) {
+ checkTheBoxes = !are_all_checked(checkbox_panel_ref);
+
+ $(checkbox_panel_ref).each(function() {
+ $(this).prop("checked", checkTheBoxes);
+ });
+}
+
+// Set the given id to All or None button depending if the checkboxes are all checked.
+function set_all_none_button(checkbox_panel_ref, all_none_button_id) {
+ if (are_all_checked(checkbox_panel_ref)) {
+ text = "<?=gettext('None')?>";
+ } else {
+ text = "<?=gettext('All')?>";
+ }
+
+ $("#" + all_none_button_id).html('<i class="fa fa-undo icon-embed-btn"></i>' + text);
+}
+
+// Setup the necessary events to manage the All/None button and included checkboxes
+// used for selecting the items to show on a widget.
+function set_widget_checkbox_events(checkbox_panel_ref, all_none_button_id) {
+ set_all_none_button(checkbox_panel_ref, all_none_button_id);
+
+ $(checkbox_panel_ref).change(function() {
+ set_all_none_button(checkbox_panel_ref, all_none_button_id);
+ });
+
+ $("#" + all_none_button_id).click(function() {
+ set_clear_checkboxes(checkbox_panel_ref);
+ set_all_none_button(checkbox_panel_ref, all_none_button_id);
+ });
+}
+
events.push(function() {
// Make panels destroyable
OpenPOWER on IntegriCloud