From 4f54796286e1cc3e31d931b73d045a4ced0d65d2 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Fri, 20 Dec 2019 08:30:47 +0000 Subject: [PATCH] Add auto-saving to all group management pages. Signed-off-by: DL6ER --- scripts/pi-hole/js/groups-adlists.js | 39 ++++++++++++++++++--------- scripts/pi-hole/js/groups-clients.js | 22 ++++++++------- scripts/pi-hole/js/groups-domains.js | 40 +++++++++++++++++++++------- scripts/pi-hole/js/groups.js | 14 ++++++---- 4 files changed, 78 insertions(+), 37 deletions(-) diff --git a/scripts/pi-hole/js/groups-adlists.js b/scripts/pi-hole/js/groups-adlists.js index 2bb73b53..5584d9e6 100644 --- a/scripts/pi-hole/js/groups-adlists.js +++ b/scripts/pi-hole/js/groups-adlists.js @@ -106,7 +106,6 @@ function initTable() { { data: null, width: "80px", orderable: false } ], drawCallback: function(settings) { - $(".editAdlist").on("click", editAdlist); $(".deleteAdlist").on("click", deleteAdlist); }, rowCallback: function(row, data) { @@ -127,20 +126,24 @@ function initTable() { (disabled ? "" : " checked") + ">" ); - $("#status", row).bootstrapToggle({ + var status = $("#status", row); + status.bootstrapToggle({ on: "Enabled", off: "Disabled", size: "small", onstyle: "success", width: "80px" }); + status.on("change", editAdlist); $("td:eq(2)", row).html( '' ); - $("#comment", row).val(data.comment); + var comment = $("#comment", row); + comment.val(data.comment); + comment.on("change", editAdlist); $("td:eq(3)", row).empty(); $("td:eq(3)", row).append( @@ -163,14 +166,9 @@ function initTable() { sel.val(data.groups); // Initialize multiselect sel.multiselect({ includeSelectAllOption: true }); + sel.on("change", editAdlist); let button = - '" + - "  " + '" + - "  " + '" + - "  " + '