[Koha-bugs] [Bug 32721] Allow UserCSS and UserJS at branch level

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jan 27 13:54:34 CET 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32721

--- Comment #1 from Matt Blenkinsop <matt.blenkinsop at ptfs-europe.com> ---
Created attachment 145731
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=145731&action=edit
Bug 32721: Add branch specific userjs and usercss

This patch allows for branch specific userJS and userCSS to be added through
the libraries table. This works in conjunction with the global UserJS and
UserCSS functionality and allows for multiple OPACs with different css and js
options.

Test plan:
1) Add to apache conf (/etc/apache2/sites-available/kohadev.conf)
    SetEnv OPAC_BRANCH_DEFAULT "FFL"
    RequestHeader add X-Koha-SetEnv "OPAC_BRANCH_DEFAULT FFL"
2) In the container, run restart_all
3) Navigate to the OPACUserJS and OPACUserCSS system preferences and add the
following: OPACUserJS - console.log('Hello from global sysprefs');, OPACUserCSS
- 'body { background-color: black; }'
4) Refresh the OPAC and the background should be black and the message should
be logged to the console in developer tools
5) Navigate to Administration > Libraries
6) On the Fairfield branch (if this does not exist you will need to create a
branch with a code matching the code that you added to the apache conf file),
click edit
7) At the bottom there should be two fields to add userjs and usercss, complete
with Codemirror syntax checking
8) In userjs add console.log('Hello from branch level'); and in usercss add
'body { background-color: blue; } then save
9) Return to the OPAC and refresh
10) If you are logged out of the OPAC it should now be logging both the message
from global and from the branch level and the background should be blue (if not
you will need to log out)
11) Log back into the OPAC using a user that DOES NOT have a default branch
matching the branch you added to the Apache conf
12) The OPAC should now revert to only showing the global message in the
console with a black background

Sponsored-by: PTFS Europe

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list