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

--- Comment #16 from Lisette Scheer <[email protected]> ---
Created attachment 210364
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210364&action=edit
Bug 39538: Replace UserCSS system preferences with snippets

This patch adds the new CSS snippets tool to the additional contents and
removes the system preferences and branch CSS.

There are 4 fewer system preferences (IntranetUserCSS, OPACUserCSS, SCOUserCSS,
SelfCheckInUserCSS) which are ported to the new snippets (StaffCSS, OPACCSS,
SelfCheckOutCSS, SelfCheckInCSS), as well as removing the branch specific CSS
from libraries as it can now be set at the branch level in additional contents.

Adding the diff for the log for the ACTN1 coding guideline added the diff for
all the additional contents.

I did allow for localization because I could see an instance in which you might
want different CSS for different languages (or JS when I get to that in another
bug).

There's a new user permission: edit_css_snippets

Test plan:

---BEFORE APPLYING PATCH---
1. Go to administration and search for usercss
    For each setting put some code, I provide examples:
    - SelfCheckInUserCSS
        body {
            background-color: oklch(0.6009 0.1184 31.76);
        }
    - SCOUserCSS
        body {
            background-color: oklch(0.7 0.1 233);
        }
    - OPACUserCSS
        body {
            background-color: oklch(0.7 0.1357 350.47);
        }
    - IntranetUserCSS
        body {
            background-color: oklch(0.4199 0.1505 292.24);
        }
2. Set WebBasedSelfCheck to 'Enable', SelfCheckInModule to 'Enable' and
AdditionalContentLog to 'Log'
3. Go to opac url/cgi-bin/koha/sco/sco-main.pl
- Observe a blue background
4. Go to opac url/cgi-bin/koha/sci/sci-main.pl and log in as koha/koha
- Observe a reddish-orange background
5. Go to the OPAC
- Observe a pink background
6. Reload the staff interface
- Observe a purple background
7. Go to Administration->Libraries, edit the library you're logged in as and
add CSS:
        body {
            background-color: oklch(0.82 0.1184 139.76);
        }
8. Go back to the OPAC, log in as koha/koha
- Observe a green background

---APPLY PATCH---
9. Apply the patch
    Update the database, yarn build, restart all

10. Search the system preferences for usercss, there should be no results.
11. Go to Administration->Libraries->edit the library you edited before, there
should be no CSS field.
12. Go to Tools->CSS snippets. There should be 5 snippets:

| Location        | Library      | Position | Publication date | Title         
           |
| --------------- | ------------ | -------- | ---------------- |
------------------------- |
| StaffCSS        | All          | 1        | Today's date     |
IntranetUserCSS           |
| OPACCSS         | All          | 1        | Today's date     | OPACUserCSS   
           |
| SelfCheckInCSS  | All          | 1        | Today's date     |
SelfCheckInUserCSS        |
| SelfCheckOutCSS | All          | 1        | Today's date     | SCOUserCSS    
           |
| OPACCSS         | Your library | 2        | Today's date     | Library
specific OPAC CSS |

13. Repeat steps 3-6 and step 8, the colors should all be the same as before.
14. Open the preview of a snippet, you should see a non-editable version of the
editor, including highlighting and linting.
15. Delete a snippet
16. Change a snippet
17. Go to the logs and filter on Additional content. Observe the difference
between the first ones (old info column) vs the new JSON format.
18. In column settings, show the diff column. Observe the before and after
comparison.
19. In the top right of the staff interface, click the bug icon and turn off
custom CSS, it should remove all the CSS snippets.

Permissions testing:
1. Set up a patron (I used 23529000035676) with permission to log into the
staff interface and to edit CSS snippets (tools > edit_css_snippets). Change
their username and password so you can log in as them.
2. In another browser or private window, log in as the second user
3. Confirm you can add, edit, and delete the snippets and do nothing else in
Tools.
4. As the superlibrarian, change it so they can edit news
(edit_additional_contents), but not snippets.
5. As the second user, confirm you can edit news but can no longer access the
CSS snippets.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to