Bug 13614

Summary: Replace usage of YUI on basket groups page
Product: Koha Reporter: Owen Leonard <oleonard>
Component: AcquisitionsAssignee: Owen Leonard <oleonard>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: david, lucas
Version: masterKeywords: Manual
Hardware: All   
OS: All   
URL: /cgi-bin/koha/acqui/basketgroup.pl
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement: 1. Updates the basket groups interface so that it doesn't rely on YUI to move baskets in and out of groups. 2. Removes all YUI assets and many long-obsolete references to YUI-related classes and IDs. For basket groups, you no longer need to drag and drop baskets between columns (which could be a bit fiddly). The basket group form is now in one column and ungrouped baskets in another. Baskets are listed in sortable tables, and using 'Add to group' and 'Remove' buttons lets you add and remove baskets from the group.
Version(s) released in:
22.11.00
Attachments: Bug 13614: Replace usage of YUI on basket groups page
Bug 13614: Replace usage of YUI on basket groups page
Bug 13614: Replace usage of YUI on basket groups page
Bug 13614: Replace usage of YUI on basket groups page

Description Owen Leonard 2015-01-22 17:47:43 UTC
basketgroup.tt is the last part of Koha that uses any YUI JavaScript. The YUI library files are now six years old and unsupported. It's time to figure out some way to update basket grouping behavior without using YUI.

The jQueryUI distribution we use already includes the Sortable interaction (http://jqueryui.com/sortable/), which may offer an alternative solution without requiring that we add additional JavaScript dependencies. However, I'm not familiar enough with it (or with basket groups) to know for sure.

I hope someone can work on this. I would really like to kill YUI JS for good.
Comment 1 Owen Leonard 2016-03-25 12:14:45 UTC
I have an idea for this but I'll wait for Bug 11708 and related bugs to go through before I work any more on it.
Comment 2 Owen Leonard 2022-05-26 17:28:38 UTC
(In reply to Owen Leonard from comment #1)
> I'll wait for Bug 11708

It's been stalled for too long, so I'm going ahead with this.
Comment 3 Owen Leonard 2022-05-26 18:23:01 UTC Comment hidden (obsolete)
Comment 4 David Nind 2022-05-29 19:16:58 UTC
Everything is working as expected, except for the second last step: no messages, such as "There are no ungrouped baskets.", are shown on the group edit form if there are no rows.

A nice improvement as well, I like the tables and the action buttons (add to group/remove) compared with the drag and drop.
Comment 5 Owen Leonard 2022-06-03 10:53:10 UTC
Created attachment 135675 [details] [review]
Bug 13614: Replace usage of YUI on basket groups page

This patch updates the basket groups interface so that it doesn't rely
on YUI to move baskets in and out of groups. The patch also removes
all YUI assets and many long-obsolete references to YUI-related classes
and IDs.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client)

- Go to Acquisitions.
- Locate a vendor with multiple closed baskets.
- Click "Basket groups" in the sidebar menu.
- Create or edit a basket group.
- On the basket group page you should see the basket group form in one
  column and ungrouped baskets in another.
- Both grouped and ungrouped baskets should be in a sortable
  DataTable.
- Test that when you click the "Add to group" button on an ungrouped
  basket the row is removed from the table of ungrouped baskets and
  added to the table of grouped baskets.
  - The button text on the row should now read "Remove."
- Test the reverse operation: Clicking "Remove" on a grouped basket
  should move it to the table of ungrouped baskets.
- Test that when all baskets are moved out of either of the tables a row
  is displayed with a message specific to that table, e.g. "There are no
  ungrouped baskets."
- Test that the basket group saves correctly when zero or more baskets
  are added to the group.
Comment 6 Owen Leonard 2022-06-03 10:54:07 UTC
(In reply to David Nind from comment #4)
> Everything is working as expected, except for the second last step: no
> messages, such as "There are no ungrouped baskets."

I left out a step in the test plan: The CSS has to be rebuilt. This allows for the message to be un-hidden.
Comment 7 David Nind 2022-06-03 13:24:16 UTC
Created attachment 135679 [details] [review]
Bug 13614: Replace usage of YUI on basket groups page

This patch updates the basket groups interface so that it doesn't rely
on YUI to move baskets in and out of groups. The patch also removes
all YUI assets and many long-obsolete references to YUI-related classes
and IDs.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client)

- Go to Acquisitions.
- Locate a vendor with multiple closed baskets.
- Click "Basket groups" in the sidebar menu.
- Create or edit a basket group.
- On the basket group page you should see the basket group form in one
  column and ungrouped baskets in another.
- Both grouped and ungrouped baskets should be in a sortable
  DataTable.
- Test that when you click the "Add to group" button on an ungrouped
  basket the row is removed from the table of ungrouped baskets and
  added to the table of grouped baskets.
  - The button text on the row should now read "Remove."
- Test the reverse operation: Clicking "Remove" on a grouped basket
  should move it to the table of ungrouped baskets.
- Test that when all baskets are moved out of either of the tables a row
  is displayed with a message specific to that table, e.g. "There are no
  ungrouped baskets."
- Test that the basket group saves correctly when zero or more baskets
  are added to the group.

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Katrin Fischer 2022-06-06 19:03:51 UTC
I think it will be good to describe the change in the release notes. 

I feel like the new GUI here is more intuitive than the old one. It always required explanation that you were supposed to drag and drop the entries and it could be a bit 'fiddly' doing so. I also imagine that the handling using buttons is more accessible. I like it!
Comment 9 Katrin Fischer 2022-06-06 19:04:35 UTC
Created attachment 135734 [details] [review]
Bug 13614: Replace usage of YUI on basket groups page

This patch updates the basket groups interface so that it doesn't rely
on YUI to move baskets in and out of groups. The patch also removes
all YUI assets and many long-obsolete references to YUI-related classes
and IDs.

To test, apply the patch and rebuild the staff interface CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client)

- Go to Acquisitions.
- Locate a vendor with multiple closed baskets.
- Click "Basket groups" in the sidebar menu.
- Create or edit a basket group.
- On the basket group page you should see the basket group form in one
  column and ungrouped baskets in another.
- Both grouped and ungrouped baskets should be in a sortable
  DataTable.
- Test that when you click the "Add to group" button on an ungrouped
  basket the row is removed from the table of ungrouped baskets and
  added to the table of grouped baskets.
  - The button text on the row should now read "Remove."
- Test the reverse operation: Clicking "Remove" on a grouped basket
  should move it to the table of ungrouped baskets.
- Test that when all baskets are moved out of either of the tables a row
  is displayed with a message specific to that table, e.g. "There are no
  ungrouped baskets."
- Test that the basket group saves correctly when zero or more baskets
  are added to the group.

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2022-06-06 19:57:07 UTC
Great to see so much code gone :)
Comment 11 Tomás Cohen Arazi 2022-06-07 12:37:33 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 12 Lucas Gass 2022-07-12 16:32:02 UTC
Doesn't apply clean to 22.05.x, no backport.

If needed please rebase.