Added support for always showing settings in cookie consent

This commit is contained in:
squidfunk 2022-10-28 16:41:14 +07:00
parent c8eac99591
commit 006f520f37
3 changed files with 21 additions and 3 deletions

View File

@ -115,9 +115,12 @@ The following properties are available:
consent:
actions:
- accept
- manage
- manage # (1)!
```
1. If the `manage` settings button is omitted from the `actions` property,
the settings are always shown.
The cookie consent form includes three types of buttons:
- `accept` Button to accept selected cookies

View File

@ -16,11 +16,15 @@
{% if not actions %}
{% set actions = ["accept", "manage"] %}
{% endif %}
{% if not "manage" in actions %}
{% set checked = "checked" %}
{% endif %}
<h4>{{ config.extra.consent.title }}</h4>
<p>{{ config.extra.consent.description }}</p>
<input type="checkbox" class="md-toggle" id="__settings">
<input class="md-toggle" type="checkbox" id="__settings" {{ checked }}>
<div class="md-consent__settings">
<ul class="task-list">
{% set checked = "" %}
{% for type in cookies %}
{% if cookies[type] is string %}
{% set name = cookies[type] %}

View File

@ -39,14 +39,25 @@
{% set actions = ["accept", "manage"] %}
{% endif %}
<!-- Determine initial settings state -->
{% if not "manage" in actions %}
{% set checked = "checked" %}
{% endif %}
<!-- Consent title -->
<h4>{{ config.extra.consent.title }}</h4>
<p>{{ config.extra.consent.description }}</p>
<!-- Consent settings -->
<input type="checkbox" class="md-toggle" id="__settings" />
<input
class="md-toggle"
type="checkbox"
id="__settings"
{{ checked }}
/>
<div class="md-consent__settings">
<ul class="task-list">
{% set checked = "" %}
{% for type in cookies %}
{% if cookies[type] is string %}
{% set name = cookies[type] %}