Allow accept essential cookies from consent banner

Set cookie duration to 365 days based on the AEPD's cookie usage guidelines.

Note from the document: "Cookies with a duration of up to 24 months are
considered acceptable as long as they are periodically updated."
Reference: https://www.aepd.es/guias/guia-cookies.pdf
This commit is contained in:
taitus
2024-12-10 11:36:38 +01:00
parent f4c3c4e639
commit 1958a77842
9 changed files with 64 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
<div id="cookies_consent_banner" class="cookies-consent-banner">
<h2><%= t("cookies_consent.title") %></h2>
<p><%= t("cookies_consent.message") %></p>
<button type="button" class="accept-essential-cookies"><%= t("cookies_consent.accept_essential_cookies") %></button>
</div>

View File

@@ -1,5 +1,13 @@
class Layout::CookiesConsent::BannerComponent < ApplicationComponent
delegate :cookies, to: :helpers
def render?
feature?(:cookies_consent)
feature?(:cookies_consent) && cookies_consent_unset?
end
private
def cookies_consent_unset?
cookies["cookies_consent"].blank?
end
end