Bug 35346: Update template logic to display 'Essential'

This patch updates the cookie consent template logic to always display
the 'Accept essential cookies' button and only expose the 'Accept all
cookies' button when there are additional cookies to accept, i.e. when
JSConsents is populated.

Test plan
1) Enable CookieConsent
2) Note you see 'Accept essential cookies' in both OPAC and Staff client
   until you have accepted them
3) Add a cookie to ConsentJS
4) Note that you will now see 'Accept all cookies' as well as the 'Accept
   essential cookies' button.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2023-11-16 13:20:58 +00:00 committed by Katrin Fischer
parent ce30f8a031
commit 96f7ef4636
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 4 additions and 4 deletions

View file

@ -93,10 +93,10 @@
</div>
[% END %]
<div id="consentButtons">
<button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button>
[% IF ( JSConsents.all('staffConsent').size ) %]
<button type="button" class="btn btn-primary consentAcceptEssential">Accept only essential cookies</button>
<button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button>
[% END %]
<button type="button" class="btn btn-primary consentAcceptEssential">Accept essential cookies</button>
<button type="button" class="btn btn-info" id="consentMoreInfo">More information</button>
</div>
</div> <!-- /#cookieConsentBar -->

View file

@ -467,10 +467,10 @@
[% PROCESS koha_news_block news => CookieConsentBar %]
[% END %]
<div id="consentButtons">
<button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button>
[% IF ( JSConsents.all('opacConsent').size ) %]
<button type="button" class="btn btn-primary consentAcceptEssential">Accept only essential cookies</button>
<button type="button" class="btn btn-primary consentAcceptAll">Accept all cookies</button>
[% END %]
<button type="button" class="btn btn-primary consentAcceptEssential">Accept essential cookies</button>
<button type="button" class="btn btn-info" id="consentMoreInfo" aria-label="Click to view more information about your cookie consents">More information</button>
</div>
</div> <!-- /#cookieConsentBar -->