Bug 39142 - Add debug permission to allow user to toggle JS and CSS customizations on/off
Summary: Add debug permission to allow user to toggle JS and CSS customizations on/off
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Imani
QA Contact: Testopia
URL:
Keywords:
Depends on: 14004
Blocks:
  Show dependency treegraph
 
Reported: 2025-02-14 15:11 UTC by Andrew Fuerste-Henry
Modified: 2025-02-21 16:01 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39142 Add debug permission to allow user to toggle JS and CSS customizations on/off (1.95 KB, patch)
2025-02-14 21:04 UTC, Imani
Details | Diff | Splinter Review
Bug 39142: Add debug permission to allow user to toggle JS and CSS customizations on/off (3.91 KB, patch)
2025-02-18 17:26 UTC, Imani
Details | Diff | Splinter Review
Bug 39142 Add debug permission to allow user to toggle JS and CSS customizations on/off (2.01 KB, patch)
2025-02-21 12:00 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 39142: Add debug permission to allow user to toggle JS and CSS customizations on/off (3.97 KB, patch)
2025-02-21 12:00 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2025-02-14 15:11:47 UTC
We all love bug 14004 and its fun tools for loading pages without JS or CSS from sysprefs. We'd like to extend that idea to toggles that would appear on every page to turn UserJS and UserCSS on and off. We'd tie those toggles to a new "debug" permission, so only users with that permission will be shown those toggles.
Comment 1 Imani 2025-02-14 21:04:58 UTC
Created attachment 178123 [details] [review]
Bug 39142 Add debug permission to allow user to toggle JS and CSS customizations on/off

Database changes for 39142
Comment 2 Imani 2025-02-18 17:26:18 UTC
Created attachment 178294 [details] [review]
Bug 39142: Add debug permission to allow user to toggle JS and CSS customizations on/off

to test:
1. apply the patch
2. use updatedatabase run to update your db
3. add custom JS and CSS in the IntranetUserJS and IntranetUserCSS fields
4. with as SuperLibrarian account confirm you have 3 buttons at the bottom of
    your screen, Disable User JS, Disable User CSS, and load only default
    stylesheets
5. clicking the buttons should reload the current page with a query to
    disable those things.
6. Log in as a user that is not a superlibrarian and does not have the
    debug UI permission enabled
7. confirm the buttons are no longer visible
8. Add the debug UI permission to the user
9. confirm the debug buttons are now visible for that user.
Comment 3 PTFS Europe Sandboxes 2025-02-21 12:00:05 UTC
Created attachment 178481 [details] [review]
Bug 39142 Add debug permission to allow user to toggle JS and CSS customizations on/off

Database changes for 39142

Signed-off-by: Lari Strand <lari.strand@koha-suomi.fi>
Comment 4 PTFS Europe Sandboxes 2025-02-21 12:00:07 UTC
Created attachment 178482 [details] [review]
Bug 39142: Add debug permission to allow user to toggle JS and CSS customizations on/off

to test:
1. apply the patch
2. use updatedatabase run to update your db
3. add custom JS and CSS in the IntranetUserJS and IntranetUserCSS fields
4. with as SuperLibrarian account confirm you have 3 buttons at the bottom of
    your screen, Disable User JS, Disable User CSS, and load only default
    stylesheets
5. clicking the buttons should reload the current page with a query to
    disable those things.
6. Log in as a user that is not a superlibrarian and does not have the
    debug UI permission enabled
7. confirm the buttons are no longer visible
8. Add the debug UI permission to the user
9. confirm the debug buttons are now visible for that user.

Signed-off-by: Lari Strand <lari.strand@koha-suomi.fi>
Comment 5 Lari Strand 2025-02-21 12:03:45 UTC
Just a thought, we use multiple Koha plugins that inject Javascript or CSS to the intranet views (subs intranet_js/css in plugin main modules). The plugins can always be disabled but maybe it should be considered as an option in this new feature?
Comment 6 Imani 2025-02-21 16:01:32 UTC
A possible future enhancement to enable that maybe setting up a plugin hook for plugins to either add to the query string generated by the debug buttons here or add debug buttons of their own.