From 7af1a0f052ace730d6d6bd2a0de457a8901bc61c Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 2 Nov 2021 16:57:49 -0300 Subject: [PATCH] Bug 29404: Add infinite scrolling to pickup location dropdowns This patch adds infinite scrolling to the pickup locations select2 dropdowns on the staff interface. It does so by adding a new transport function (in select2.js) to read the response headers Koha's API sends back, and converting to the right data structure Select2 expects for the feature to work. This is manually used in the different pickup locations dropdowns. There's a separate bug that will introduce a select2 wrapper that will probably embed this function in it. To test: 1. Run the [DO NOT PUSH] script inside koha-shell to generate random pickup locations: $ kshell k$ perl generate_pickup_locations.pl 2. Try placing holds. Notice the visible pickup locations dropdowns display some pickup locations based on the matches you got. They are all fetched once => SUCCESS: It works 3. Repeat for the current holds page and the patron holds listing => SUCCESS: Same behavior 4. Apply this patch 5. Repeat 2 and 3 => SUCCESS: Things work, but pickup locations are retrieved as needed, while you scroll. 6. Sign off :-D Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- .../prog/en/modules/reserve/request.tt | 47 +++++++------------ koha-tmpl/intranet-tmpl/prog/js/holds.js | 41 ++++++++-------- koha-tmpl/intranet-tmpl/prog/js/select2.js | 20 ++++++++ 3 files changed, 59 insertions(+), 49 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt index 794bb6fafa..7fc53d3d1c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -1131,6 +1131,7 @@ [% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("js/circ-patron-search-results.js") | $raw %] [% INCLUDE 'select2.inc' %] + [% Asset.js("js/holds.js") | $raw%]