diff options
author | moisseev <moiseev@mezonplus.ru> | 2024-03-08 19:47:18 +0300 |
---|---|---|
committer | moisseev <moiseev@mezonplus.ru> | 2024-03-08 19:47:18 +0300 |
commit | 72b660061dc0951f8fd4a35003264308617bcec6 (patch) | |
tree | b466bdcc0378484f522c21101b44fbcc733e6203 | |
parent | a7776b19ce9bcb71e8309b94bd108274e256aa95 (diff) | |
download | rspamd-72b660061dc0951f8fd4a35003264308617bcec6.tar.gz rspamd-72b660061dc0951f8fd4a35003264308617bcec6.zip |
[WebUI] Add check/uncheck all checkboxes buttons
to table filter dropdowns
-rw-r--r-- | interface/css/rspamd.css | 4 | ||||
-rw-r--r-- | interface/js/app/common.js | 19 | ||||
-rw-r--r-- | interface/js/app/libft.js | 2 | ||||
-rw-r--r-- | interface/js/app/symbols.js | 2 |
4 files changed, 27 insertions, 0 deletions
diff --git a/interface/css/rspamd.css b/interface/css/rspamd.css index d21dfd605..4885e6d7f 100644 --- a/interface/css/rspamd.css +++ b/interface/css/rspamd.css @@ -311,6 +311,10 @@ table#symbolsTable input[type="number"] { .footable tr:not(.footable-detail-row) > td { font-size: 11px; } +.footable-dropdown-btn-group { + padding: 0 20px; + margin: 7px 0; +} .status-table tr:last-child td:last-child { border-radius: 0 0 calc(var(--bs-border-radius) + 1px) 0; diff --git a/interface/js/app/common.js b/interface/js/app/common.js index 0364ed0e9..1fc723542 100644 --- a/interface/js/app/common.js +++ b/interface/js/app/common.js @@ -234,5 +234,24 @@ define(["jquery", "nprogress"], return String(string).replace(htmlEscaper, (match) => htmlEscapes[match]); }; + ui.appendButtonsToFtFilterDropdown = (ftFilter) => { + function button(text, classes, check) { + return $("<button/>", { + type: "button", + class: "btn btn-xs " + classes, + text: text, + click: () => { + const checkboxes = ftFilter.$dropdown.find(".checkbox input"); + return (check) ? checkboxes.attr("checked", "checked") : checkboxes.removeAttr("checked"); + } + }); + } + + $("<div/>", {class: "d-flex justify-content-between footable-dropdown-btn-group"}).append( + button("Check all", "btn-secondary", true), + button("Uncheck all", "btn-outline-secondary ms-1") + ).appendTo(ftFilter.$dropdown); + }; + return ui; }); diff --git a/interface/js/app/libft.js b/interface/js/app/libft.js index 1dfc9ef79..faf16489b 100644 --- a/interface/js/app/libft.js +++ b/interface/js/app/libft.js @@ -293,6 +293,8 @@ define(["jquery", "app/common", "footable"], $.each(self.actions, (i, action) => { self.$action.append($("<option/>").text(action)); }); + + common.appendButtonsToFtFilterDropdown(self); }, _onStatusDropdownChanged: function (e) { const {self} = e.data; diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index 21d83b1c3..893eddb3b 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -160,6 +160,8 @@ define(["jquery", "app/common", "footable"], $.each(self.groups, (i, group) => { self.$group.append($("<option/>").text(group)); }); + + common.appendButtonsToFtFilterDropdown(self); }, _onStatusDropdownChanged: function (e) { const {self} = e.data; |