Bug 29404: Add infinite scrolling to pickup location dropdowns
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 2 Nov 2021 19:57:49 +0000 (16:57 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 8 Nov 2021 10:42:07 +0000 (11:42 +0100)
commit7af1a0f052ace730d6d6bd2a0de457a8901bc61c
tree92bf0270585b1f955b70e5219b7746e3f1d131b6
parente4efbe396a7575a4b969b9caeab65ba60cf39d2f
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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
koha-tmpl/intranet-tmpl/prog/js/holds.js
koha-tmpl/intranet-tmpl/prog/js/select2.js