Bug 26847 - Make borrower category code accessible in all pages of the OPAC
Summary: Make borrower category code accessible in all pages of the OPAC
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Renvoize
QA Contact: Victor Grousset/tuxayo
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2020-10-28 14:33 UTC by Rickard Lindfors
Modified: 2021-02-26 08:38 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.02


Attachments
Bug 26847: Add unit test for categorycode in masthead (1.60 KB, patch)
2020-11-04 15:00 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 26847: Add data-categorycode to opac pages (1.94 KB, patch)
2020-11-04 15:00 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 26847: Add unit test for categorycode in masthead (1.64 KB, patch)
2020-11-04 16:33 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 26847: Add data-categorycode to opac pages (2.00 KB, patch)
2020-11-04 16:33 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 26847: Add UI test for categorycode in masthead (1.70 KB, patch)
2020-12-29 16:07 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 26847: Add data-categorycode to opac pages (2.05 KB, patch)
2020-12-29 16:07 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 26847: (follow-up) fix get_attribute() call (1.27 KB, patch)
2021-01-05 13:25 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Rickard Lindfors 2020-10-28 14:33:55 UTC
It would be useful to see which borrower category a user has when logged in. This way, the library could personalize information with javascript, to certain categories.

On every page, there's for example: data-borrowernumber and data-branchcode. Maybe here, it would be suitable for a data-borrowercategory?
Comment 1 Martin Renvoize 2020-11-04 15:00:34 UTC
Created attachment 113003 [details] [review]
Bug 26847: Add unit test for categorycode in masthead

This unit test adds a regression test for the addition of categorycode
into the masthead of the staff client.
Comment 2 Martin Renvoize 2020-11-04 15:00:37 UTC
Created attachment 113004 [details] [review]
Bug 26847: Add data-categorycode to opac pages

This patch adds the data-categorycode attribute to the loggedinuser span
for all pages in the opac.

Test plan
1/ Apply first patch, varify unit test fails.
2/ Apply second patch, varify unit test now passes.
3/ Navigate to opac and login
4/ Varify that data-categorycode is present in the loggedinuser span in
the client.
Comment 3 Lucas Gass 2020-11-04 16:33:40 UTC
Created attachment 113012 [details] [review]
Bug 26847: Add unit test for categorycode in masthead

This unit test adds a regression test for the addition of categorycode
into the masthead of the staff client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 4 Lucas Gass 2020-11-04 16:33:49 UTC
Created attachment 113013 [details] [review]
Bug 26847: Add data-categorycode to opac pages

This patch adds the data-categorycode attribute to the loggedinuser span
for all pages in the opac.

Test plan
1/ Apply first patch, varify unit test fails.
2/ Apply second patch, varify unit test now passes.
3/ Navigate to opac and login
4/ Varify that data-categorycode is present in the loggedinuser span in
the client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 5 Victor Grousset/tuxayo 2020-12-29 16:07:20 UTC
Created attachment 114726 [details] [review]
Bug 26847: Add UI test for categorycode in masthead

This test adds a regression test for the addition of categorycode
into the masthead of the staff client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 6 Victor Grousset/tuxayo 2020-12-29 16:07:24 UTC
Created attachment 114727 [details] [review]
Bug 26847: Add data-categorycode to opac pages

This patch adds the data-categorycode attribute to the loggedinuser span
for all pages in the opac.

Test plan
1/ Apply first patch, varify unit test fails.
2/ Apply second patch, varify unit test now passes.
3/ Navigate to opac and login
4/ Varify that data-categorycode is present in the loggedinuser span in
the client.

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 7 Victor Grousset/tuxayo 2020-12-29 19:37:10 UTC
Comment on attachment 113012 [details] [review]
Bug 26847: Add unit test for categorycode in masthead

Fixed test terminology in the commit message "unit test" => "UI test"
Comment 8 David Cook 2021-01-04 01:27:59 UTC
Another idea is to provide a Javascript object that is accessible by Javascript. 

That could be a more extensible way of getting this functionality.
Comment 9 Katrin Fischer 2021-01-04 08:08:15 UTC
(In reply to David Cook from comment #8)
> Another idea is to provide a Javascript object that is accessible by
> Javascript. 
> 
> That could be a more extensible way of getting this functionality.

But it would make it harder to tie CSS to it. I think having it in the HTML works well for both.
Comment 10 Jonathan Druart 2021-01-04 15:34:22 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 11 David Cook 2021-01-04 22:24:58 UTC
(In reply to Katrin Fischer from comment #9)
> (In reply to David Cook from comment #8)
> > Another idea is to provide a Javascript object that is accessible by
> > Javascript. 
> > 
> > That could be a more extensible way of getting this functionality.
> 
> But it would make it harder to tie CSS to it. I think having it in the HTML
> works well for both.

Looking at the previous comments, no one mentioned CSS; they only mentioned Javascript. But I think that you make a really good point. It could be interesting to use CSS tied to borrower category.
Comment 12 Victor Grousset/tuxayo 2021-01-05 13:25:12 UTC
Created attachment 114872 [details] [review]
Bug 26847: (follow-up) fix get_attribute() call

Since the upgrade to Selenium 3 in bug 27055, an additional parameter is
required for get_attribute() to actually work.
https://metacpan.org/pod/Selenium::Remote::WebElement#get_attribute
Comment 13 Jonathan Druart 2021-01-05 13:41:17 UTC
Last patch pushed to master for 21.05.00
Comment 14 Fridolin Somers 2021-01-07 14:31:44 UTC
Small yet useful enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.02
Comment 15 Andrew Fuerste-Henry 2021-01-12 14:40:41 UTC
Enhancement, not backported to 20.05. Please ask if needed
Comment 16 Rickard Lindfors 2021-02-26 08:38:17 UTC
Yes, please backport to 20.05 :)