From c6c0f928911b07c2409b28b0873efd057b68a7d6 Mon Sep 17 00:00:00 2001 From: Richard Schreiber Date: Fri, 19 Feb 2021 11:03:47 +0100 Subject: [PATCH] =?UTF-8?q?moved=20update()-event=20to=20checkboxes?= =?UTF-8?q?=E2=80=99=20change-event,=20added=20row-highlight=20if=20select?= =?UTF-8?q?ed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pretix/static/pretixcontrol/js/ui/main.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pretix/static/pretixcontrol/js/ui/main.js b/src/pretix/static/pretixcontrol/js/ui/main.js index 93c36fe8a9..90ac2b204d 100644 --- a/src/pretix/static/pretixcontrol/js/ui/main.js +++ b/src/pretix/static/pretixcontrol/js/ui/main.js @@ -689,6 +689,8 @@ $(function () { if (!checkbox.hasAttribute("data-inital")) checkbox.setAttribute("data-inital", checkbox.checked); if (checked === undefined || checked === null) checkbox.checked = checkbox.getAttribute("data-inital") === "true"; else checkbox.checked = checked; + + $(checkbox).trigger("change"); } }; var onChangeSelection = function(ev) { @@ -732,7 +734,6 @@ $(function () { ev.preventDefault(); onChangeSelectionHappened = false; $checkboxes.removeAttr("data-inital"); - update(); } $rows.off("pointerenter", onChangeSelection); }); @@ -754,9 +755,12 @@ $(function () { $toggle.prop("checked", all_same).prop("indeterminate", false); }; - $(this).closest("table").find("td:first-child input[type=checkbox]").change(update); + $checkboxes.change(function() { + $(this).closest("tr").toggleClass("warning", this.checked); + update(); + }); $(this).change(function (ev) { - $(this).closest("table").find("td:first-child input[type=checkbox]").prop("checked", $(this).prop("checked")); + $checkboxes.prop("checked", this.checked).trigger("change"); }); });