Allow managing versions of cookies consent
This can be useful when adding a new cookie or making modifications that require asking the user again.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<%= 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("cookies_consent.more_info_link", type: :text, tab: tab) %>
|
||||
<%= render Admin::Settings::RowComponent.new("cookies_consent.version_name", type: :text, tab: tab) %>
|
||||
<% end %>
|
||||
|
||||
<%= render Admin::Cookies::Vendors::TableComponent.new %>
|
||||
|
||||
@@ -8,6 +8,6 @@ class Layout::CookiesConsent::BannerComponent < Layout::CookiesConsent::BaseComp
|
||||
private
|
||||
|
||||
def cookies_consent_unset?
|
||||
cookies["cookies_consent"].blank?
|
||||
cookies["cookies_consent_#{version_name}"].blank?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,4 +10,8 @@ class Layout::CookiesConsent::BaseComponent < ApplicationComponent
|
||||
def vendors
|
||||
Cookies::Vendor.all
|
||||
end
|
||||
|
||||
def version_name
|
||||
Setting["cookies_consent.version_name"].to_s.strip
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<section id="cookies_consent_management" class="cookies-consent-management reveal" data-reveal aria-labelledby="modal_heading">
|
||||
<section id="cookies_consent_management"
|
||||
class="cookies-consent-management reveal"
|
||||
data-reveal
|
||||
aria-labelledby="modal_heading"
|
||||
data-version-name="<%= version_name %>">
|
||||
<header>
|
||||
<h2 id="modal_heading"><%= t("cookies_management.title") %></h2>
|
||||
<button class="close-button" aria-label="<%= t("admin.shared.close_modal") %>" type="button" data-close>
|
||||
|
||||
Reference in New Issue
Block a user