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.
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.
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>
Created attachment 127280 [details] [review] Bug 29397: Add function documentation Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
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>
Thanks for the documentation follow-up Tomas :).. nice to see the pickup_locations code show this in use too :)
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>
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>
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>
Tested and signed off on the follow-up :)
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>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
There were two follow-up patches that are missing here!
ooh, yeah.. where did those go :(
I've un-obsoleted the two patches.. did you test these too Kyle.. looks like a simple git-bz mishap to me.
(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!
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>
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>
Back to the RM queue. Fridolin: the last two patches are missing in master. Thanks!
(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