Bug 27378: Introduce cookie consent to OPAC and staff client
authorMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Mon, 11 Jan 2021 14:50:17 +0000 (14:50 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 12 Sep 2023 12:45:07 +0000 (09:45 -0300)
commit49bfb9ff39b8b0a652a2bfdaa93ffb2c5d3b3a8c
treec143d274cc48d85ef343a6091bdd8b8da3a7095b
parent272a080cb35fe83e9f11ab8401effb7223f5d94c
Bug 27378: Introduce cookie consent to OPAC and staff client

To avoid confusion around commit messages and the content of this enhancement, this first commit is a squashed commit of all the original code submited to this bug. Following a few years of inactivity, it has been rebased and re-submitted with some fixes and concept changes contained in the more recent commits.

Signed-ff-by: Barry Cannon <bc@interleaf.ie>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (follow-up) Add missing filters

(cherry picked from commit 6b8565b949b62269f6d850e6d412458d0dbcfb37)
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Fix accessibility issues

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Update to new atomicupdate structure

This patch consolidates the previous 4 database update files into one atomicupdate file in line with the new structure

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Change ConsentJS to CookieConsentedJS

This patch updates the name of the ConsentJS syspref to CookieConsentedJS and amends the description to be more clear what the syspref is for

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Stop the codemirror editor and delete confirmation from duplicating

Previously, if the "Add new code button" was clicked in the CookieConsentedJS editor, the original entry would have duplicated CodeMirror editors.
This was exponential, i.e adding two new lines would result in three codemirror editors appearing on the first entry, two on the second and so on.
The click event was not being applied properly and was being applied to every element with the .expand-textarea class, rather than specifically the new elements being created. The addExpandHandler function now loops through each element individually and decides whether to apply the click event handler.

Similarly, the delete confirmation was dupliacting for the same reason. This has also been resolved.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: Remove two sysprefs and replace with html customisations

Currently there are two sysprefs - CookieConsentBar and CookieConsentPopup. These allow the user to select what text they would like to see in the consent bar and modal. These have been removed and replaced with HTML customisations to allow more flexible customisations and different languages.

Sponsored by: PTFS-Europe

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Small fixes and tidy-ups

This patch does the following:
- Realphabetizes the lines in sysprefs.sql
- Fixes a formatting error in patrons.pref
- Adjusts the position of the cookie consent bar if the language selector is visible
- Fixes translatability on the syspref modal

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Allow staff to view their cookie consents

This patch allows staff to view their cookie consents through a link in the dropdown menu in the navbar. Previously staff had no way of accessing their cookie consents

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Add cancel button to cookie modal

This patch adds a cancel button to the modal for reviewing cookie consents. Previously there was no way to exit without selecting one of the cookie options

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Add filtering for OPAC only and staff only cookies

This patch fixes an issue where cookies selected as OPAC only would still show in the staff client and vise versa. The cookies are now filtered and only the correct cookies will be used in the OPAC and staff client

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Bug 27378: (QA follow-up) Fix tests and character encoding

This patch fixes an encoding issue when using diacritics. It also fixes a failing test, corrects the format of the "Cancel" links in the modal and perltidy has been used on all relevant files

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
21 files changed:
Koha/AdditionalContents.pm
Koha/Template/Plugin/JSConsents.pm [new file with mode: 0644]
admin/preferences.pl
installer/data/mysql/atomicupdate/bug_27378-add_cookie_consents.pl [new file with mode: 0644]
installer/data/mysql/mandatory/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/css/preferences.css
koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
koha-tmpl/intranet-tmpl/prog/en/includes/header.inc
koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt
koha-tmpl/intranet-tmpl/prog/js/cookieconsent.js [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js
koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-patron-consent.tt
koha-tmpl/opac-tmpl/bootstrap/js/cookieconsent.js [new file with mode: 0644]
t/db_dependent/Koha/Template/Plugin/JSConsents.t [new file with mode: 0755]