Skip to content

Commit

Permalink
Merge pull request #51 from DemocracyClub/blackpool-recall
Browse files Browse the repository at this point in the history
Blackpool recall
  • Loading branch information
symroe authored Mar 15, 2024
2 parents d7092cf + 7736376 commit 34b0ff6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "pypi"

[packages]
starlette = {extras = ["jinja2"], version = "==0.28.0"}
jinja2 = "3.1.2"
jinja2 = "3.1.3"
mangum = "==0.15.0"
httpx = "0.23.1"
babel = "==2.11.0"
Expand Down
8 changes: 4 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions postcode_lookup/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ async def base_uprn_endpoint(request: Request, backend=None):
context["request"] = request
context["postcode"] = postcode
context["url_prefix"] = backend.URL_PREFIX
if api_response.get("parl_recall_petition"):
context["parl_recall_petition"] = api_response["parl_recall_petition"]
if "signing_start" in context["parl_recall_petition"]:
context["parl_recall_petition"]["signing_start"] = parse(
context["parl_recall_petition"]["signing_start"]
)
if "signing_end" in context["parl_recall_petition"]:
context["parl_recall_petition"]["signing_end"] = parse(
context["parl_recall_petition"]["signing_end"]
)
template_name = "uprn.html"
if context["api_response"].address_picker:
template_name = "address_picker.html"
Expand Down
6 changes: 3 additions & 3 deletions postcode_lookup/templates/address_picker.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends request.base_template %}

{% block page_title %}
Multiple polling stations / electoral services were found for {{ postcode }}
Pick your address
{% endblock %}

{% block language_picker %}
Expand All @@ -15,7 +15,7 @@
<section class="container" aria-labelledby="polling-station-results">
<div class="polling-station">
<div class="polling-station__list">
<h2>Please select an address from this list:</h2>
<h2>To make sure we get you the correct information, please pick your address:</h2>

<ul class="links">
{% for address in api_response.addresses %}
Expand All @@ -26,4 +26,4 @@ <h2>Please select an address from this list:</h2>
</div>
</div>
</section>
{% endblock %}
{% endblock %}
14 changes: 6 additions & 8 deletions postcode_lookup/templates/includes/parl_recall_petition.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div class="dc-grid">
<div class="dc-ballot">
{% if parl_recall_petition.signing_start and parl_recall_petition.signing_end %}
<h2>{{ parl_recall_petition.signing_start.strftime('%-d %B %Y') }} – {{ parl_recall_petition.signing_end.strftime('%-d %B %Y') }}</h2>
<h2>{{ parl_recall_petition.name }}</h2>
<h3>{{ parl_recall_petition.signing_start.strftime('%-d %B %Y') }} – {{ parl_recall_petition.signing_end.strftime('%-d %B %Y') }}</h3>
{% endif %}


Expand All @@ -10,9 +11,6 @@ <h2>{{ parl_recall_petition.signing_start.strftime('%-d %B %Y') }} – {{ pa
<p>By signing a recall petition, you are saying you want your MP to lose their seat.
You only need to sign the petition if you want to see your MP removed.</p>

{# TODO #}
{# <p><a href="#" style="text-decoration: underline;">Find out more about recall petitions.</a></p>#}

<p>You have six weeks to sign the petition at your signing place.</p>
<p>You’ll need to take photo ID with you. <a href="https://www.electoralcommission.org.uk/i-am-a/voter/voter-id/accepted-forms-photo-id" style="text-decoration: underline;">
Check the list of accepted forms of photo ID</a>.</p>
Expand All @@ -24,22 +22,22 @@ <h2>{{ parl_recall_petition.signing_start.strftime('%-d %B %Y') }} – {{ pa
<div class="polling-station__address">
<div class="c-summary-box c-summary-box--grey">
<h3>Your signing place</h3>
{% if parl_recall_petition.signing_station %}
{% if parl_recall_petition.signing_station.address %}
<p>
{{ parl_recall_petition.signing_station.address.replace("\n", "<br>")|safe }}<br>
{{ parl_recall_petition.signing_station.postcode }}
</p>
{% else %}
<p>See <a href="https://www.northnorthants.gov.uk/elections-and-voting/recall-petition-wellingborough-constituency" style="text-decoration: underline">
North Northamptonshire's website</a> to find your signing place, or contact them using the details below.
<p>See <a href="https://www.blackpool.gov.uk/Your-Council/Voting-and-elections/Recall-petition/Recall-petition-Blackpool-South.aspx" style="text-decoration: underline">
Blackpool Council's website</a> to find your signing place, or contact them using the details below.
</p>
{% endif %}



<h3>Opening times</h3>
<p>Monday to Friday — 9am – 5pm</p>
<p>There are extended opening hours of 9am until 8pm on Monday 13 November 2023</p>
<p>Please note: the petition wil be closed due to bank holidays on Friday 29 March and Monday 1 April 2024.</p>
</div>
</div>

Expand Down
56 changes: 33 additions & 23 deletions postcode_lookup/templates/result.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
{% if api_response.dates.0.notifications and api_response.dates.0.notifications.0.type == "cancelled_election" %}
Cancelled election
{% else %}
{% trans %}You have an upcoming election{% endtrans %}
{% if parl_recall_petition %}
{% trans %}You have upcoming elections{% endtrans %}
{% else %}
{% trans %}You have an upcoming election{% endtrans %}
{% endif %}
{% endif %}

{% endif %}
Expand All @@ -29,7 +33,11 @@
{% if api_response.dates.0.notifications and api_response.dates.0.notifications.0.type == "cancelled_election" %}
Cancelled election
{% else %}
{% trans %}You have an upcoming election{% endtrans %}
{% if parl_recall_petition %}
{% trans %}You have upcoming elections{% endtrans %}
{% else %}
{% trans %}You have an upcoming election{% endtrans %}
{% endif %}
{% endif %}
{% endif %}
{% else %}
Expand All @@ -51,20 +59,22 @@

<style>
.dc-container {
margin-top:3.5rem;
margin-top: 3.5rem;
}

.dc-container .dc-grid {
display: flex;
flex-wrap: wrap;
flex-grow: 1;
}

.dc-container .dc-grid .dc-polling-station {
flex-basis: 20em;
flex-grow: 1;


}

.dc-container .dc-grid .dc-ballot {
flex-basis: 0;
flex-grow: 999;
Expand All @@ -74,33 +84,37 @@
width: 95%;
}

@media screen and (max-width:767px){
@media screen and (max-width: 767px) {
.dc-container .dc-grid {
display: block;
}

.dc-container .l-content-w-sidebar {
width: 100%;
}

.dc-container {
margin-top:1rem;
margin-top: 1rem;
}

}

</style>

<div class="dc-container">
{% if parl_recall_petition %}
{% include "includes/parl_recall_petition.html" %}
{% endif %}

{% if api_response.dates %}
<p class="c-polling-station-slice">
You’ll need to take photo ID with you if you’re voting at the polling station.
<a href="https://www.electoralcommission.org.uk/i-am-a/voter/voter-id/accepted-forms-photo-id" style="text-decoration: underline;">
You’ll need to take photo ID with you if you’re voting {% if parl_recall_petition %}or signing{% endif %} in person.
<a href="https://www.electoralcommission.org.uk/i-am-a/voter/voter-id/accepted-forms-photo-id"
style="text-decoration: underline;">
Check the list of accepted forms of photo ID</a>.
</p>
{% endif %}
{% if parl_recall_petition %}
{% include "includes/parl_recall_petition.html" %}
{% endif %}



{% for date in api_response.dates %}
<h2 class="o-type-h2">{{ date.date|date_filter }}</h2>
Expand All @@ -116,35 +130,31 @@ <h2 class="o-type-h2">{{ date.date|date_filter }}</h2>
</div>
{% if not date.notifications.0.type == "cancelled_election" %}
<div class="dc-polling-station">
{% include "includes/polling_station.html" %}
{% include "includes/polling_station.html" %}
</div>
{% endif %}
</div>
{% else%}
{% else %}
{% if not parl_recall_petition %}
<p>You can register to vote at any time.
<a href="https://www.gov.uk/register-to-vote" class="link-underline">Register to vote now</a>.</p>
<p>You can register to vote at any time.
<a href="https://www.gov.uk/register-to-vote" class="link-underline">Register to vote now</a>.</p>
{% endif %}

{% endfor %}






</div>

{% if api_response.registration == api_response.electoral_services %}
{% with org = api_response.electoral_services, org_type="registration" %}
{% include "includes/organisation_contact.html" %}
{% include "includes/organisation_contact.html" %}
{% endwith %}
{% else %}
{% else %}
{% with org = api_response.registration, org_type="registration" %}
{% include "includes/organisation_contact.html" %}
{% include "includes/organisation_contact.html" %}
{% endwith %}
{% with org = api_response.electoral_services, org_type="electoral_services" %}
{% include "includes/organisation_contact.html" %}
{% include "includes/organisation_contact.html" %}
{% endwith %}
{% endif %}

Expand Down

0 comments on commit 34b0ff6

Please sign in to comment.