-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add settings for the cookie page and the digital emissions page (#287)
* Add settings for the cookie page and the digital emissions page
- Loading branch information
Showing
5 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
from django.conf import settings | ||
|
||
from tbx.core.models import ImportantPageSettings | ||
|
||
|
||
def global_vars(request): | ||
return { | ||
"GOOGLE_TAG_MANAGER_ID": getattr(settings, "GOOGLE_TAG_MANAGER_ID", None), | ||
"SEO_NOINDEX": settings.SEO_NOINDEX, | ||
"COOKIE_POLICY_PAGE": ImportantPageSettings.for_request( | ||
request | ||
).cookie_policy_page, | ||
"CARBON_EMISSIONS_PAGE": ImportantPageSettings.for_request( | ||
request | ||
).carbon_emissions_page, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Generated by Django 4.2.11 on 2024-07-22 13:39 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("wagtailcore", "0091_remove_revision_submitted_for_moderation"), | ||
("torchbox", "0034_add_earth_colour_theme"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ImportantPageSettings", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"carbon_emissions_page", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="wagtailcore.page", | ||
), | ||
), | ||
( | ||
"cookie_policy_page", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="wagtailcore.page", | ||
), | ||
), | ||
( | ||
"site", | ||
models.OneToOneField( | ||
editable=False, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="wagtailcore.site", | ||
), | ||
), | ||
], | ||
options={ | ||
"abstract": False, | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 7 additions & 1 deletion
8
tbx/project_styleguide/templates/patterns/molecules/carbon-impact/carbon-impact.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
{% load wagtailcore_tags %} | ||
|
||
<div class="grid footer__carbon-impact-container" data-page-carbon> | ||
<div class="grid__carbon-impact"> | ||
<div class="footer__carbon-impact"> | ||
<p class="footer__carbon-impact-text">Loading the site homepage emits just <span>0.07g of CO2</span> per view.</p> | ||
<p class="footer__carbon-impact-text"><a href="/about/digital-emissions/" class="footer__carbon-impact-link">Find out more about our carbon impact</a></p> | ||
{% if CARBON_EMISSIONS_PAGE %} | ||
<p class="footer__carbon-impact-text"> | ||
<a href="{% pageurl CARBON_EMISSIONS_PAGE %}" class="footer__carbon-impact-link">Find out more about our carbon impact</a> | ||
</p> | ||
{% endif %} | ||
</div> | ||
</div> | ||
</div> |
3 changes: 2 additions & 1 deletion
3
tbx/project_styleguide/templates/patterns/molecules/cookie-message/cookie-message.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters