Bug 29932

Summary: Phase out jquery.cookie.js: bibs_selected (Browse selected records)
Product: Koha Reporter: Owen Leonard <oleonard>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: andrewfh, jonathan.druart, testopia, victor
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.03,21.05.11
Bug Depends on: 19290    
Bug Blocks: 27750    
Attachments: Bug 29932: Use localStorage instead of cookie for bibs_selected
Bug 29932: Use localStorage instead of cookie for bibs_selected
Bug 29932: Use localStorage instead of cookie for bibs_selected

Description Owen Leonard 2022-01-24 17:54:10 UTC
The "Browse selected records" feature (enabled by the BrowseResultSelection system preference) sets a "bibs_selected" cookie when the user checks items in staff interface catalog search results. This cookie can be replaced with the use of localStorage.
Comment 1 Owen Leonard 2022-01-24 18:13:32 UTC
Created attachment 129734 [details] [review]
Bug 29932: Use localStorage instead of cookie for bibs_selected

This patch replaces the use of the jquery.cookie.js plugin in the
"Browse selected records" feature. The feature is modified to use
localStorage instead of cookies.

To test, apply the patch and go to Administration -> System preferences.

 - Enable the "BrowseResultSelection" system preference.
 - Perform a catalog search which will return multiple results.
 - On the search results page, check the checkbox for a number of
   titles.
 - Click the "Browse selected biblios" button in the toolbar.
 - You should be directed to the detail page for the first title you
   checked.
 - Clicking the right-arrow in the sidebar should take you
   through each one of your selected titles.
 - When you click the "Results" link in the sidebar you should be
   returned to the same search results set and the same titles should be
   checked.
 _ If you uncheck those titles and reload the page the checkboxes should
   remain unchecked.
 - If you log out of the staff interface the "bibs_selected" item in
   localStorage should be deleted. See, for example,
   https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector for
   information about viewing local storage.
Comment 2 David Nind 2022-01-25 17:18:10 UTC
Created attachment 129809 [details] [review]
Bug 29932: Use localStorage instead of cookie for bibs_selected

This patch replaces the use of the jquery.cookie.js plugin in the
"Browse selected records" feature. The feature is modified to use
localStorage instead of cookies.

To test, apply the patch and go to Administration -> System preferences.

 - Enable the "BrowseResultSelection" system preference.
 - Perform a catalog search which will return multiple results.
 - On the search results page, check the checkbox for a number of
   titles.
 - Click the "Browse selected biblios" button in the toolbar.
 - You should be directed to the detail page for the first title you
   checked.
 - Clicking the right-arrow in the sidebar should take you
   through each one of your selected titles.
 - When you click the "Results" link in the sidebar you should be
   returned to the same search results set and the same titles should be
   checked.
 _ If you uncheck those titles and reload the page the checkboxes should
   remain unchecked.
 - If you log out of the staff interface the "bibs_selected" item in
   localStorage should be deleted. See, for example,
   https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector for
   information about viewing local storage.

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 Jonathan Druart 2022-01-27 10:17:59 UTC
Created attachment 129858 [details] [review]
Bug 29932: Use localStorage instead of cookie for bibs_selected

This patch replaces the use of the jquery.cookie.js plugin in the
"Browse selected records" feature. The feature is modified to use
localStorage instead of cookies.

To test, apply the patch and go to Administration -> System preferences.

 - Enable the "BrowseResultSelection" system preference.
 - Perform a catalog search which will return multiple results.
 - On the search results page, check the checkbox for a number of
   titles.
 - Click the "Browse selected biblios" button in the toolbar.
 - You should be directed to the detail page for the first title you
   checked.
 - Clicking the right-arrow in the sidebar should take you
   through each one of your selected titles.
 - When you click the "Results" link in the sidebar you should be
   returned to the same search results set and the same titles should be
   checked.
 _ If you uncheck those titles and reload the page the checkboxes should
   remain unchecked.
 - If you log out of the staff interface the "bibs_selected" item in
   localStorage should be deleted. See, for example,
   https://developer.mozilla.org/en-US/docs/Tools/Storage_Inspector for
   information about viewing local storage.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Fridolin Somers 2022-02-10 01:36:45 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 5 Andrew Fuerste-Henry 2022-02-21 16:29:15 UTC
I see this has been pushed to 21.11.
Pushed to 21.05.x for 21.05.11
Comment 6 Victor Grousset/tuxayo 2022-02-24 23:37:42 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.