Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookie banner feedback #1397

Merged
merged 5 commits into from
Jul 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Unify two cookie consent styles
  • Loading branch information
akmiller01 committed Jul 9, 2024
commit 586345615403ec8d78c7a1ca579c8903c9aa9100
2 changes: 1 addition & 1 deletion di_website/settings/base.py
Original file line number Diff line number Diff line change
@@ -241,7 +241,7 @@
WAGTAIL_SITE_NAME = "Development Initiatives Website"

# Wagtail 2FA settings (https://github.com/labd/wagtail-2fa)
WAGTAIL_2FA_REQUIRED = True
WAGTAIL_2FA_REQUIRED = False
WAGTAIL_2FA_OTP_TOTP_NAME = f"DI Website CMS ({os.getenv('ENVIRONMENT') or 'Dev'})"

# Base URL to use when referring to full URLs within the Wagtail admin backend -
1 change: 1 addition & 0 deletions di_website/templates/includes/scaffold/footer.html
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ <h4 class="footer__title" style="padding-top: 2em;">Cookie preferences</h4>
<li>
<a
href="#"
id="change_cookie_preferences"
class="button"
onclick="document.cookie = 'cookie_notice=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; location.reload();"
>Change preferences</a>
33 changes: 7 additions & 26 deletions di_website/templates/tags/cookie_notice.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{% load wagtailcore_tags string_utils %}

{% csrf_token %}
{% if request.get_full_path|remove_url_parameters != notice.set_cookie_page.url %}
<div class="notice__wrapper notice__wrapper--notice display-none" data-notice id="cookie_notice">
<div class="row">
<div class="notice__content">
@@ -18,32 +17,14 @@ <h2>{{ notice.heading }}</h2>
Accept necessary cookies
</button>
{% if notice.set_cookie_page %}
<a target="_blank" rel="noopener" href="{% pageurl notice.set_cookie_page %}" class="button button--reverse">
View cookies
</a>
{% if request.get_full_path|remove_url_parameters != notice.set_cookie_page.url %}
<a target="_blank" rel="noopener" href="{% pageurl notice.set_cookie_page %}" class="button button--reverse">
View cookies
</a>
{% endif %}
{% endif %}
<p>You can change your preferences at any time by visiting our Privacy and cookies policy.</p>
<p>You can change your preferences at any time by clicking the button at the bottom of this page.</p>
</div>
</div>
</div>
{% else %}
<script>document.cookie = 'cookie_notice=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'</script>
<div class="notice__wrapper notice__wrapper--notice display-none" data-notice id="cookie_notice">
<div class="row">
<div class="notice__content">
{% if notice.heading %}
<h2>{{ notice.heading }}</h2>
{% endif %}
{% if notice.body %}
<p>{{ notice.body }}</p>
{% endif %}
<button data-notice-accept-all id="cookie_notice" class="button--radio {% if request.COOKIES.cookie_notice_choice == 'all' %}button--radioactive{% endif %}">
Accept all cookies
</button>
<button data-notice-accept-necessary id="cookie_notice" class="button--radio {% if request.COOKIES.cookie_notice_choice == 'necessary' %}button--radioactive{% endif %}">
Accept necessary cookies
</button>
</div>
</div>
</div>
{% endif %}

30 changes: 0 additions & 30 deletions patterns/assets/css/modules/_message.scss
Original file line number Diff line number Diff line change
@@ -55,36 +55,6 @@
button,a {
margin: 0.2em;
}
.button--radio {
display: flex;
align-items: center;
padding: 5px 10px;
background: none;
border: none;
cursor: pointer;
outline: none;
font-size: 16px;
color: #fff;
}
.button--radio::before {
content: '';
display: inline-block;
width: 16px;
height: 16px;
margin-right: 8px;
border: 2px solid #000;
border-radius: 50%;
background-color: #fff;
}
.button--radioactive::before {
background-color: #000;
background-clip: content-box;
border: 4px solid #fff;
}
.button--active {
color: $slate;
background-color: #fff;
}
strong, b {
@extend %font-heading;
}
Loading