From 8b65d5acb9d443e344bb672c9c71ac895c854b46 Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Fri, 25 Oct 2024 07:41:07 +0000 Subject: [PATCH] Bug 38222: (QA follow-up) DRY event listener setup for combobox resets on modal close MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sponsored-by: Büchereizentrale Schleswig-Holstein Signed-off-by: Martin Renvoize --- koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt | 4 ---- koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 5 ----- .../intranet-tmpl/prog/en/modules/members/moremember.tt | 4 ---- koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js | 6 ++++++ 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt index 2610464c658..31155c64365 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/bookings/list.tt @@ -386,10 +386,6 @@ placeholder: _("Select or type a reason"), }); - document.getElementById("cancelBookingModal")?.addEventListener('hide.bs.modal', () => { - $("#cancellation-reason").comboBox('reset'); - }); - function handleFilter(e, text, filterStates) { const target = e.target; const { filter } = target.dataset; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 26a89d1e838..e96fa9f1488 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1148,11 +1148,6 @@ displayProperty: 'name', placeholder: _("Select or type a reason"), }); - - document.getElementById("cancelBookingModal")?.addEventListener('hide.bs.modal', () => { - $("#cancellation-reason").comboBox('reset'); - }); - }); [% INCLUDE 'str/members-menu.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index 7e0c205b45f..dbd55ea1394 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -832,10 +832,6 @@ displayProperty: 'name', placeholder: _("Select or type a reason"), }); - - document.getElementById("cancelBookingModal")?.addEventListener('hide.bs.modal', () => { - $("#cancellation-reason").comboBox('reset'); - }); }); [% Asset.js("js/tables/bookings.js") | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js b/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js index d34196b1296..f146eaa1695 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cancel_booking_modal.js @@ -6,6 +6,12 @@ .getElementById("cancelBookingForm") ?.addEventListener("submit", handleSubmit); + document + .getElementById("cancelBookingModal") + ?.addEventListener("hide.bs.modal", () => { + $("#cancellation-reason").comboBox("reset"); + }); + async function handleSubmit(e) { e.preventDefault(); -- 2.47.0