Bug 27016 - Make the pickup locations dropdowns use Select2
Summary: Make the pickup locations dropdowns use Select2
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Nick Clemens
URL:
Keywords:
Depends on: 26988 27015
Blocks: 27732
  Show dependency treegraph
 
Reported: 2020-11-13 13:33 UTC by Tomás Cohen Arazi
Modified: 2022-06-06 20:24 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement improves the display of the pickup library dropdown list in the holds section for a record, particularly for long lists. Enhancements include being able to start typing the name of the library and search for the library.
Version(s) released in:
21.05.00


Attachments
Bug 27016: Make the pickup locations dropdowns use Select2 (4.93 KB, patch)
2020-11-17 15:19 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 27016: Make the pickup locations dropdowns use Select2 (5.02 KB, patch)
2020-11-17 16:00 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 27016: Make the pickup locations dropdowns use Select2 (5.08 KB, patch)
2020-11-17 20:05 UTC, David Nind
Details | Diff | Splinter Review
Bug 27016: Make the pickup locations dropdowns use Select2 (5.13 KB, patch)
2020-11-18 15:49 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 27016: (QA follow-up) Move allowClear out of ajax (1.20 KB, patch)
2020-11-18 15:49 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 27016: Use $.fn.select2.defaults.set to set select2's width (1015 bytes, patch)
2021-01-04 15:27 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2020-11-13 13:33:30 UTC
On top of bug 26988, we can nicely use Select2 on those dropdowns. This would be beneficial on sites with many branches.
Comment 1 Tomás Cohen Arazi 2020-11-17 15:19:42 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi 2020-11-17 16:00:23 UTC
Created attachment 113740 [details] [review]
Bug 27016: Make the pickup locations dropdowns use Select2

On the shoulders of bug 27015, this patch makes the pickup locations
dropdowns use Select2 to handle both fetching the pickup location
on-deman through the API, and also searching for them.

This provides a better user experience for really big lists.

To test:
1. Have some holds on a biblio
=> SUCCESS: Bug 26988 works, made it load the data when you click on the
dropdowns.
2. Apply this patch
3. Reload the page
=> SUCCESS: Similar-ish behaviour
=> SUCCESS: Notice you can search for branch names and make the list
shrink
4. Sign off :-D
Comment 3 David Nind 2020-11-17 20:05:14 UTC
Created attachment 113760 [details] [review]
Bug 27016: Make the pickup locations dropdowns use Select2

On the shoulders of bug 27015, this patch makes the pickup locations
dropdowns use Select2 to handle both fetching the pickup location
on-deman through the API, and also searching for them.

This provides a better user experience for really big lists.

To test:
1. Have some holds on a biblio
=> SUCCESS: Bug 26988 works, made it load the data when you click on the
dropdowns.
2. Apply this patch
3. Reload the page
=> SUCCESS: Similar-ish behaviour
=> SUCCESS: Notice you can search for branch names and make the list
shrink
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2020-11-17 20:15:59 UTC
The only thing I noticed when testing is that for library names with spaces in the name wrap (such as Institut Protestant de Théologie), rather than being on the same 'line'. 

I'm assuming this is the default behaviour for Select2.
Comment 5 Tomás Cohen Arazi 2020-11-17 21:02:34 UTC
(In reply to David Nind from comment #4)
> The only thing I noticed when testing is that for library names with spaces
> in the name wrap (such as Institut Protestant de Théologie), rather than
> being on the same 'line'. 
> 
> I'm assuming this is the default behaviour for Select2.

Good point. We could fix that. I felt like the experience was better with no geometry changes when the API call gets the results. So I'm open to discuss this.
Comment 6 David Nind 2020-11-18 10:10:21 UTC
I think it is a great improvement.
Comment 7 Tomás Cohen Arazi 2020-11-18 14:07:37 UTC
(In reply to David Nind from comment #6)
> I think it is a great improvement.

Thanks!
Comment 8 Nick Clemens 2020-11-18 15:49:14 UTC
Created attachment 113791 [details] [review]
Bug 27016: Make the pickup locations dropdowns use Select2

On the shoulders of bug 27015, this patch makes the pickup locations
dropdowns use Select2 to handle both fetching the pickup location
on-deman through the API, and also searching for them.

This provides a better user experience for really big lists.

To test:
1. Have some holds on a biblio
=> SUCCESS: Bug 26988 works, made it load the data when you click on the
dropdowns.
2. Apply this patch
3. Reload the page
=> SUCCESS: Similar-ish behaviour
=> SUCCESS: Notice you can search for branch names and make the list
shrink
4. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Nick Clemens 2020-11-18 15:49:18 UTC
Created attachment 113792 [details] [review]
Bug 27016: (QA follow-up) Move allowClear out of ajax

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Jonathan Druart 2021-01-04 15:27:45 UTC
Created attachment 114807 [details] [review]
Bug 27016: Use $.fn.select2.defaults.set to set select2's width

See commit ff7318c62ec7097c5b88f7278b71d0cc7feb1f39
    Bug 27124: JS error "select2Width is not defined"
Comment 11 Jonathan Druart 2021-01-04 15:34:32 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 12 Fridolin Somers 2021-01-07 14:50:03 UTC
Enhancement not pushed to 20.11.x