Allow accept essential cookies from management modal

This commit is contained in:
taitus
2024-12-10 17:50:35 +01:00
parent df34853792
commit d35455624f
7 changed files with 39 additions and 4 deletions

View File

@@ -3,6 +3,7 @@
App.CookiesConsent = {
hide: function() {
$("#cookies_consent_banner").hide();
$("#cookies_consent_management").foundation("close");
},
initialize: function() {
$(".accept-essential-cookies").on("click", function() {

View File

@@ -13,4 +13,21 @@
.close-button {
@include modal-close-button;
}
.buttons {
border-top: 1px solid $medium-gray;
padding-top: $line-height;
button {
@include breakpoint(small only) {
display: block;
width: 100%;
}
&.accept-essential-cookies {
@include regular-button;
margin-bottom: 0;
}
}
}
}

View File

@@ -9,4 +9,8 @@
<h3><%= t("cookies_management.essentials.title") %></h3>
<p><%= t("cookies_management.essentials.description") %></p>
<div class="buttons">
<button type="button" class="accept-essential-cookies"><%= t("cookies_consent.accept_essential_cookies") %></button>
</div>
</section>

View File

@@ -942,7 +942,7 @@ en:
title: "Cookies policy"
cookies_management:
title: Cookies management
description: This website uses own cookies for its proper functioning.
description: This website uses own for its proper functioning. By clicking the Accept essential cookies button, you agree to the use of these technologies and the processing of your data for these purposes.
essentials:
title: Essential cookies
description: They are used for many different purposes, such as recognising you as a user, choosing the language or customising the way in which content is displayed.

View File

@@ -942,7 +942,7 @@ es:
title: "Política de cookies"
cookies_management:
title: Configuración de cookies
description: Esta web utiliza cookies propias para su correcto funcionamiento.
description: Esta web utiliza cookies propias para su correcto funcionamiento. Al hacer click en el botón Aceptar cookies esenciales, acepta el uso de estas tecnologías y el procesamiento de tus datos para estos propósitos.
essentials:
title: Cookies esenciales
description: Utilizadas para finalidades muy diversas, como por ejemplo, reconocerte como usuario, elegir el idioma o personalizar la forma en la que se muestra el contenido.

View File

@@ -17,5 +17,6 @@ describe Layout::CookiesConsent::ManagementComponent do
expect(page).to be_rendered
expect(page).to have_css "h2", text: "Cookies management"
expect(page).to have_css "h3", text: "Essential cookies"
expect(page).to have_button "Accept essential cookies"
end
end

View File

@@ -23,14 +23,26 @@ describe "Cookies consent" do
end
context "Management modal" do
scenario "Allow users access to cookies management modal" do
scenario "Allow users to accept essential cookies and hide management modal" do
visit root_path
expect(cookie_by_name("cookies_consent")).to be nil
within ".cookies-consent-banner" do
click_button "Manage cookies"
end
expect(page).to have_css "h2", text: "Cookies management"
within ".cookies-consent-management" do
click_button "Accept essential cookies"
end
expect(cookie_by_name("cookies_consent")[:value]).to eq "essential"
expect(page).not_to have_content "Cookies policy"
expect(page).not_to have_content "Cookies management"
refresh
expect(page).not_to have_content "Cookies policy"
end
end
end