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
committerRenato Botelho <renato@netgate.com>2017-05-03 09:26:17 -0300
commit14c6cfa0ba499c695d7da58e22cb2215541bddea (patch)
treea286272defe0fafcd3deb2cfc05e288c3d7b5023 /src/usr/local/www/index.php
parent35c395e0781c3665af19d7251c23e73ec4b5864f (diff)
downloadpfsense-14c6cfa0ba499c695d7da58e22cb2215541bddea.zip
pfsense-14c6cfa0ba499c695d7da58e22cb2215541bddea.tar.gz
Redmine #7318 None button for widget filters
(cherry picked from commit fba53b438540eb544c43adf4598e07320a910347)
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 4d9535e..a7dde79 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -482,6 +482,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