Bug 29397 - Add a select2 wrapper for the API
Summary: Add a select2 wrapper for the API
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Renvoize
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on: 29407
Blocks: 29002
  Show dependency treegraph
 
Reported: 2021-11-02 16:32 UTC by Tomás Cohen Arazi
Modified: 2022-02-22 15:01 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.03


Attachments
Bug 29397: Add .kohaSelect select2 wrapper function (2.09 KB, patch)
2021-11-03 14:41 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29397: Add .kohaSelect select2 wrapper function (2.22 KB, patch)
2021-11-03 17:59 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29397: Add function documentation (1.26 KB, patch)
2021-11-03 17:59 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29397: Use kohaSelect for pickup locations (2.54 KB, patch)
2021-11-03 17:59 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29397: Add .kohaSelect select2 wrapper function (2.29 KB, patch)
2021-11-04 13:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29397: Add function documentation (1.33 KB, patch)
2021-11-04 13:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29397: Use kohaSelect for pickup locations (2.61 KB, patch)
2021-11-04 13:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 29397: Add .kohaSelect select2 wrapper function (2.34 KB, patch)
2022-01-06 19:56 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 29397: Add function documentation (1.38 KB, patch)
2022-02-07 12:57 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 29397: Use kohaSelect for pickup locations (2.66 KB, patch)
2022-02-07 12:57 UTC, Tomás Cohen Arazi
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 2021-11-02 16:32:14 UTC
It should handle the 'data' and 'processResults' data transformations, and allow being passed a function for converting the result data into something suitable for using on each use case.
Comment 1 Martin Renvoize 2021-11-03 14:41:55 UTC
Created attachment 127265 [details] [review]
Bug 29397: Add .kohaSelect select2 wrapper function

This patch adds a kohaSelect wrapper function to simplify
paging/infinite scrolling with select2 using the Koha RESTful api's.

Invoke select2 select boxes as you normally would from JS, but instead
of calling .select2(config) use .kohaSelect(config).

If an 'ajax' property is defined in your config object, we wrap the
transport such that responses include a pagination key as expected by
select2.
Comment 2 Tomás Cohen Arazi 2021-11-03 17:59:11 UTC
Created attachment 127279 [details] [review]
Bug 29397: Add .kohaSelect select2 wrapper function

This patch adds a kohaSelect wrapper function to simplify
paging/infinite scrolling with select2 using the Koha RESTful api's.

Invoke select2 select boxes as you normally would from JS, but instead
of calling .select2(config) use .kohaSelect(config).

If an 'ajax' property is defined in your config object, we wrap the
transport such that responses include a pagination key as expected by
select2.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 3 Tomás Cohen Arazi 2021-11-03 17:59:18 UTC
Created attachment 127280 [details] [review]
Bug 29397: Add function documentation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2021-11-03 17:59:24 UTC
Created attachment 127281 [details] [review]
Bug 29397: Use kohaSelect for pickup locations

This patch makes the pickup location dropdowns that rely on Select2 and
the API use the new wrapper. The original transport function is removed
as it is now embedded in the wrapper.

To test:
1. Follow bug 29404 test plan
=> SUCCESS: All works
2. Apply this patches
3. Repeat 1
=> SUCCESS: All works!
4. sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Martin Renvoize 2021-11-04 13:47:54 UTC
Thanks for the documentation follow-up Tomas :).. nice to see the pickup_locations code show this in use too :)
Comment 6 Martin Renvoize 2021-11-04 13:49:05 UTC
Created attachment 127320 [details] [review]
Bug 29397: Add .kohaSelect select2 wrapper function

This patch adds a kohaSelect wrapper function to simplify
paging/infinite scrolling with select2 using the Koha RESTful api's.

Invoke select2 select boxes as you normally would from JS, but instead
of calling .select2(config) use .kohaSelect(config).

If an 'ajax' property is defined in your config object, we wrap the
transport such that responses include a pagination key as expected by
select2.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Martin Renvoize 2021-11-04 13:49:08 UTC
Created attachment 127321 [details] [review]
Bug 29397: Add function documentation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2021-11-04 13:49:12 UTC
Created attachment 127322 [details] [review]
Bug 29397: Use kohaSelect for pickup locations

This patch makes the pickup location dropdowns that rely on Select2 and
the API use the new wrapper. The original transport function is removed
as it is now embedded in the wrapper.

To test:
1. Follow bug 29404 test plan
=> SUCCESS: All works
2. Apply this patches
3. Repeat 1
=> SUCCESS: All works!
4. sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2021-11-04 13:49:31 UTC
Tested and signed off on the follow-up :)
Comment 10 Kyle M Hall 2022-01-06 19:56:59 UTC
Created attachment 129117 [details] [review]
Bug 29397: Add .kohaSelect select2 wrapper function

This patch adds a kohaSelect wrapper function to simplify
paging/infinite scrolling with select2 using the Koha RESTful api's.

Invoke select2 select boxes as you normally would from JS, but instead
of calling .select2(config) use .kohaSelect(config).

If an 'ajax' property is defined in your config object, we wrap the
transport such that responses include a pagination key as expected by
select2.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Fridolin Somers 2022-01-22 07:40:36 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 12 Tomás Cohen Arazi 2022-01-22 18:29:30 UTC
There were two follow-up patches that are missing here!
Comment 13 Martin Renvoize 2022-01-31 10:10:32 UTC
ooh, yeah.. where did those go :(
Comment 14 Martin Renvoize 2022-01-31 10:12:19 UTC
I've un-obsoleted the two patches.. did you test these too Kyle.. looks like a simple git-bz mishap to me.
Comment 15 Kyle M Hall 2022-02-07 12:04:07 UTC
(In reply to Martin Renvoize from comment #14)
> I've un-obsoleted the two patches.. did you test these too Kyle.. looks like
> a simple git-bz mishap to me.

I believe you are correct sir!
Comment 16 Tomás Cohen Arazi 2022-02-07 12:57:47 UTC
Created attachment 130221 [details] [review]
Bug 29397: Add function documentation

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 17 Tomás Cohen Arazi 2022-02-07 12:57:51 UTC
Created attachment 130222 [details] [review]
Bug 29397: Use kohaSelect for pickup locations

This patch makes the pickup location dropdowns that rely on Select2 and
the API use the new wrapper. The original transport function is removed
as it is now embedded in the wrapper.

To test:
1. Follow bug 29404 test plan
=> SUCCESS: All works
2. Apply this patches
3. Repeat 1
=> SUCCESS: All works!
4. sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 18 Tomás Cohen Arazi 2022-02-07 13:08:48 UTC
Back to the RM queue.

Fridolin: the last two patches are missing in master. Thanks!
Comment 19 Fridolin Somers 2022-02-11 00:06:43 UTC
(In reply to Tomás Cohen Arazi from comment #18)
> Back to the RM queue.
> 
> Fridolin: the last two patches are missing in master. Thanks!

Done