Skip to content

Commit

Permalink
[scorecards] display the correct year in the hero banner
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed May 28, 2024
1 parent ef347c0 commit 2400e99
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
5 changes: 1 addition & 4 deletions scoring/templates/scoring/council.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

{% block content %}
<div class="hero-section with-version-background py-5 py-lg-6">
<div class="d-flex flex-column align-items-end align-items-lg-start hero-version-badge position-absolute">
<span class="version-year d-block fw-bold lh-1">2023</span>
<span class="version-name d-block fw-bold lh-1">Action Scorecards</span>
</div>
{% include 'scoring/includes/scorecards_year.html' %}
<div class="container">
<nav class="d-flex align-items-center flex-wrap mb-n2">
<a href="{% include 'scoring/includes/scoring_url.html' with slug=council.get_scoring_group.slug %}" class="btn btn-sm btn-outline-primary d-flex align-items-center mb-2 me-3">
Expand Down
5 changes: 1 addition & 4 deletions scoring/templates/scoring/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
{% block content %}

<div class="pt-5 pb-6 pt-lg-8 pb-lg-8 hero-section with-version-background">
<div class="d-flex flex-column align-items-end align-items-lg-start hero-version-badge position-absolute">
<span class="version-year d-block fw-bold lh-1">2023</span>
<span class="version-name d-block fw-bold lh-1">Action Scorecards</span>
</div>
{% include 'scoring/includes/scorecards_year.html' %}
<div class="container">
<h1 class="mb-3">Action Scorecards</h1>
<p class="mb-4" style="max-width: 650px;">Climate Emergency UK assessed all UK councils on the actions they've taken towards net zero. The Scorecard assessment consists of 91 questions or less, depending on council type, across 7 different sections, created in consultation with over 90 different organisations and individuals. Each council was marked against these criteria and given a right to reply before the scores underwent a final audit. This work was completed between January and August 2023.
Expand Down
4 changes: 4 additions & 0 deletions scoring/templates/scoring/includes/scorecards_year.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="d-flex flex-column align-items-end align-items-lg-start hero-version-badge position-absolute">
<span class="version-year d-block fw-bold lh-1">{{ plan_year }}</span>
<span class="version-name d-block fw-bold lh-1">Action Scorecards</span>
</div>
2 changes: 1 addition & 1 deletion scoring/templates/scoring/privacy.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<div class="pt-5 pb-6 pt-lg-8 pb-lg-8 hero-section with-version-background">
<div class="d-flex flex-column align-items-end align-items-lg-start hero-version-badge position-absolute">
<span class="version-year d-block fw-bold lh-1">2023</span>
<span class="version-year d-block fw-bold lh-1"></span>
<span class="version-name d-block fw-bold lh-1">Action Scorecards</span>
</div>
<div class="container">
Expand Down
7 changes: 2 additions & 5 deletions scoring/templates/scoring/question.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

{% block content %}
<div class="pt-5 pb-6 pt-lg-8 pb-lg-8 hero-section with-version-background">
<div class="d-flex flex-column align-items-end align-items-lg-start hero-version-badge position-absolute">
<span class="version-year d-block fw-bold lh-1">2023</span>
<span class="version-name d-block fw-bold lh-1">Action Scorecards</span>
</div>
{% include 'scoring/includes/scorecards_year.html' %}
<div class="container">
<h2 class="fs-4">Action Scorecards 2023</h2>
<h2 class="fs-4">Action Scorecards {{ plan_year }}</h2>
<h1 class="mb-2">Question: {{ question.text }}</h1>
<dl class="row mt-4 mb-0" style="max-width: 30em">
<dt class="col-sm-4">Question code</dt>
Expand Down
7 changes: 2 additions & 5 deletions scoring/templates/scoring/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

{% block content %}
<div class="pt-5 pb-6 pt-lg-8 pb-lg-8 hero-section with-version-background">
<div class="d-flex flex-column align-items-end align-items-lg-start hero-version-badge position-absolute">
<span class="version-year d-block fw-bold lh-1">2023</span>
<span class="version-name d-block fw-bold lh-1">Action Scorecards</span>
</div>
{% include 'scoring/includes/scorecards_year.html' %}
<div class="container">
<h2 class="fs-4">Action Scorecards 2023</h2>
<h2 class="fs-4">Action Scorecards {{ plan_year }}</h2>
<h1 class="mb-2">{{ section.description }}</h1>
<div class="row mt-3">
<div class="col-lg-6">
Expand Down
7 changes: 2 additions & 5 deletions scoring/templates/scoring/sections.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

{% block content %}
<div class="pt-5 pb-6 pt-lg-8 pb-lg-8 hero-section with-version-background">
<div class="d-flex flex-column align-items-end align-items-lg-start hero-version-badge position-absolute">
<span class="version-year d-block fw-bold lh-1">2023</span>
<span class="version-name d-block fw-bold lh-1">Action Scorecards</span>
</div>
{% include 'scoring/includes/scorecards_year.html' %}
<div class="container">
<h2 class="fs-4">Action Scorecards 2023</h2>
<h2 class="fs-4">Action Scorecards {{ plan_year }}</h2>
<h1 class="mb-2">Sections</h1>
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions scoring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def get_context_data(self, **kwargs):
context["sorted_by"] = sorted_by
context["council_data"] = councils
context["averages"] = averages
context["plan_year"] = self.request.year

title_format_strings = {
"single": "Council Climate Action Scorecards",
Expand Down Expand Up @@ -397,6 +398,7 @@ def get_context_data(self, **kwargs):
context["authority_type"] = group
context["plan_score"] = plan_score
context["plan_urls"] = plan_urls
context["plan_year"] = self.request.year
context["sections"] = sorted(
sections.values(), key=lambda section: section["code"]
)
Expand Down Expand Up @@ -486,6 +488,7 @@ def get_context_data(self, **kwargs):
context["authority_type"] = group
context["council"] = council
context["score"] = top.weighted_total
context["plan_year"] = self.request.year

return context

Expand All @@ -500,6 +503,7 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
council = context.get("council")
context["page_title"] = council.name
context["plan_year"] = self.request.year
return context


Expand Down Expand Up @@ -667,6 +671,7 @@ def get_context_data(self, **kwargs):
context["council_type_avg"] = avgs[context["council_type"]["slug"]]

context["canonical_path"] = self.request.path
context["plan_year"] = self.request.year
return context


Expand Down Expand Up @@ -708,6 +713,7 @@ def get_context_data(self, **kwargs):
context["ca_sections"].append(details)

context["canonical_path"] = self.request.path
context["plan_year"] = self.request.year
return context


Expand Down Expand Up @@ -739,6 +745,7 @@ def get_context_data(self, **kwargs):
context["section"] = section
context["authority_type"] = group
context["scores"] = scores
context["plan_year"] = self.request.year

return context

Expand All @@ -764,6 +771,7 @@ def get_context_data(self, **kwargs):
context["section"] = section
context["score"] = top.weighted_score
context["council"] = top.plan_score.council
context["plan_year"] = self.request.year

return context

Expand Down Expand Up @@ -791,6 +799,7 @@ def get_context_data(self, **kwargs):
context["section"] = section
context["score"] = scores.weighted_score
context["council"] = scores.plan_score.council
context["plan_year"] = self.request.year

return context

Expand Down Expand Up @@ -862,6 +871,7 @@ def get_context_data(self, **kwargs):

context["totals"] = [totals[k] for k in sorted(totals.keys())]

context["plan_year"] = self.request.year
return context


Expand Down

0 comments on commit 2400e99

Please sign in to comment.