Add an optional setting with the link to the cookies policy page
This commit is contained in:
@@ -2,4 +2,5 @@
|
|||||||
|
|
||||||
<%= render Admin::Settings::TableComponent.new(setting_name: "feature") do %>
|
<%= render Admin::Settings::TableComponent.new(setting_name: "feature") do %>
|
||||||
<%= render Admin::Settings::RowComponent.new("feature.cookies_consent", type: :feature, tab: tab) %>
|
<%= render Admin::Settings::RowComponent.new("feature.cookies_consent", type: :feature, tab: tab) %>
|
||||||
|
<%= render Admin::Settings::RowComponent.new("cookies_consent.more_info_link", type: :text, tab: tab) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
<div id="cookies_consent_banner" class="cookies-consent-banner">
|
<div id="cookies_consent_banner" class="cookies-consent-banner">
|
||||||
<h2><%= t("cookies_consent.title") %></h2>
|
<h2><%= t("cookies_consent.title") %></h2>
|
||||||
<p><%= t("cookies_consent.message") %></p>
|
<p><%= t("cookies_consent.message") %></p>
|
||||||
|
<% if more_info_link.present? %>
|
||||||
|
<p><%= link_to t("cookies_consent.more_info_link"), more_info_link %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<button type="button" class="accept-essential-cookies"><%= t("cookies_consent.accept_essential_cookies") %></button>
|
<button type="button" class="accept-essential-cookies"><%= t("cookies_consent.accept_essential_cookies") %></button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ class Layout::CookiesConsent::BannerComponent < ApplicationComponent
|
|||||||
feature?(:cookies_consent) && cookies_consent_unset?
|
feature?(:cookies_consent) && cookies_consent_unset?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def more_info_link
|
||||||
|
Setting["cookies_consent.more_info_link"]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def cookies_consent_unset?
|
def cookies_consent_unset?
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ class Setting < ApplicationRecord
|
|||||||
"related_content_score_threshold": -0.3,
|
"related_content_score_threshold": -0.3,
|
||||||
"featured_proposals_number": 3,
|
"featured_proposals_number": 3,
|
||||||
"feature.dashboard.notification_emails": nil,
|
"feature.dashboard.notification_emails": nil,
|
||||||
|
"cookies_consent.more_info_link": "",
|
||||||
"machine_learning.comments_summary": false,
|
"machine_learning.comments_summary": false,
|
||||||
"machine_learning.related_content": false,
|
"machine_learning.related_content": false,
|
||||||
"machine_learning.tags": false,
|
"machine_learning.tags": false,
|
||||||
|
|||||||
@@ -936,4 +936,5 @@ en:
|
|||||||
cookies_consent:
|
cookies_consent:
|
||||||
accept_essential_cookies: "Accept essential cookies"
|
accept_essential_cookies: "Accept essential cookies"
|
||||||
message: "Cookies help us deliver our services. By using our services, you agree to our use of cookies."
|
message: "Cookies help us deliver our services. By using our services, you agree to our use of cookies."
|
||||||
|
more_info_link: "More information about cookies"
|
||||||
title: "Cookies policy"
|
title: "Cookies policy"
|
||||||
|
|||||||
@@ -228,3 +228,6 @@ en:
|
|||||||
budgets_description: Allow participatory budgets to be linked to Sustainable Development Goals
|
budgets_description: Allow participatory budgets to be linked to Sustainable Development Goals
|
||||||
legislation: Related SDG in collaborative legislation
|
legislation: Related SDG in collaborative legislation
|
||||||
legislation_description: Allow collaborative legislation to be linked to Sustainable Development Goals
|
legislation_description: Allow collaborative legislation to be linked to Sustainable Development Goals
|
||||||
|
cookies_consent:
|
||||||
|
more_info_link: Link to cookies policy
|
||||||
|
more_info_link_description: Link shown in the consent banner to the cookie policy page.
|
||||||
|
|||||||
@@ -936,4 +936,5 @@ es:
|
|||||||
cookies_consent:
|
cookies_consent:
|
||||||
accept_essential_cookies: "Aceptar cookies esenciales"
|
accept_essential_cookies: "Aceptar cookies esenciales"
|
||||||
message: "Las cookies nos ayudan a ofrecer nuestros servicios. Al utilizar nuestros servicios, aceptas el uso de cookies."
|
message: "Las cookies nos ayudan a ofrecer nuestros servicios. Al utilizar nuestros servicios, aceptas el uso de cookies."
|
||||||
|
more_info_link: "Más información sobre cookies"
|
||||||
title: "Política de cookies"
|
title: "Política de cookies"
|
||||||
|
|||||||
@@ -228,3 +228,6 @@ es:
|
|||||||
budgets_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en presupuestos participativos
|
budgets_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en presupuestos participativos
|
||||||
legislation: Alineamiento ODS en legislación colaborativa
|
legislation: Alineamiento ODS en legislación colaborativa
|
||||||
legislation_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en legislación colaborativa
|
legislation_description: Permitir alineamiento de los Objetivos de Desarrollo Sostenible en legislación colaborativa
|
||||||
|
cookies_consent:
|
||||||
|
more_info_link: Enlace a la política de cookies
|
||||||
|
more_info_link_description: Enlace que se muestra en el banner de consentimiento a la página de política de cookies
|
||||||
|
|||||||
@@ -20,10 +20,22 @@ describe Layout::CookiesConsent::BannerComponent do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "renders the banner content when feature `cookies_consent` is enabled and cookies were not accepted" do
|
it "renders the banner content when feature `cookies_consent` is enabled and cookies were not accepted" do
|
||||||
|
Setting["cookies_consent.more_info_link"] = "/cookies_policy"
|
||||||
|
|
||||||
render_inline Layout::CookiesConsent::BannerComponent.new
|
render_inline Layout::CookiesConsent::BannerComponent.new
|
||||||
|
|
||||||
expect(page).to be_rendered
|
expect(page).to be_rendered
|
||||||
expect(page).to have_css "h2", text: "Cookies policy"
|
expect(page).to have_css "h2", text: "Cookies policy"
|
||||||
|
expect(page).to have_link "More information about cookies", href: "/cookies_policy"
|
||||||
expect(page).to have_button "Accept essential cookies"
|
expect(page).to have_button "Accept essential cookies"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "does not render a link when the setting `cookies_consent.more_info_link` is not defined" do
|
||||||
|
Setting["cookies_consent.more_info_link"] = ""
|
||||||
|
|
||||||
|
render_inline Layout::CookiesConsent::BannerComponent.new
|
||||||
|
|
||||||
|
expect(page).not_to have_link "More information about cookies"
|
||||||
|
expect(page).to be_rendered
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user