Skip to content

Commit 006f520

Browse files
committed
Added support for always showing settings in cookie consent
1 parent c8eac99 commit 006f520

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

docs/setup/ensuring-data-privacy.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ The following properties are available:
115115
consent:
116116
actions:
117117
- accept
118-
- manage
118+
- manage # (1)!
119119
```
120120

121+
1. If the `manage` settings button is omitted from the `actions` property,
122+
the settings are always shown.
123+
121124
The cookie consent form includes three types of buttons:
122125

123126
- `accept` – Button to accept selected cookies

material/partials/consent.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@
1616
{% if not actions %}
1717
{% set actions = ["accept", "manage"] %}
1818
{% endif %}
19+
{% if not "manage" in actions %}
20+
{% set checked = "checked" %}
21+
{% endif %}
1922
<h4>{{ config.extra.consent.title }}</h4>
2023
<p>{{ config.extra.consent.description }}</p>
21-
<input type="checkbox" class="md-toggle" id="__settings">
24+
<input class="md-toggle" type="checkbox" id="__settings" {{ checked }}>
2225
<div class="md-consent__settings">
2326
<ul class="task-list">
27+
{% set checked = "" %}
2428
{% for type in cookies %}
2529
{% if cookies[type] is string %}
2630
{% set name = cookies[type] %}

src/partials/consent.html

+12-1
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,25 @@
3939
{% set actions = ["accept", "manage"] %}
4040
{% endif %}
4141

42+
<!-- Determine initial settings state -->
43+
{% if not "manage" in actions %}
44+
{% set checked = "checked" %}
45+
{% endif %}
46+
4247
<!-- Consent title -->
4348
<h4>{{ config.extra.consent.title }}</h4>
4449
<p>{{ config.extra.consent.description }}</p>
4550

4651
<!-- Consent settings -->
47-
<input type="checkbox" class="md-toggle" id="__settings" />
52+
<input
53+
class="md-toggle"
54+
type="checkbox"
55+
id="__settings"
56+
{{ checked }}
57+
/>
4858
<div class="md-consent__settings">
4959
<ul class="task-list">
60+
{% set checked = "" %}
5061
{% for type in cookies %}
5162
{% if cookies[type] is string %}
5263
{% set name = cookies[type] %}

0 commit comments

Comments
 (0)