From a2e922829301cc73edbbe93f6073974c1d727d5b Mon Sep 17 00:00:00 2001 From: chris48s Date: Wed, 30 Oct 2024 13:41:04 +0000 Subject: [PATCH 1/3] remove redundant code --- postcode_lookup/templates/includes/ballots.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/postcode_lookup/templates/includes/ballots.html b/postcode_lookup/templates/includes/ballots.html index b29d503..29fb2bc 100644 --- a/postcode_lookup/templates/includes/ballots.html +++ b/postcode_lookup/templates/includes/ballots.html @@ -1,8 +1,5 @@ {% for ballot in date.date_data.ballots %}
- {% if not section.response_type.name == "ONE_CURRENT_BALLOT" %} - - {% endif %} {% if ballot.cancelled %} {% include 'includes/cancellation_reasons.html' %} {% else %} From 1c97bf1784378ae52976b4385a43cc1efc0ba0a3 Mon Sep 17 00:00:00 2001 From: chris48s Date: Wed, 30 Oct 2024 13:41:39 +0000 Subject: [PATCH 2/3] include election name in canddiates header this stops us from showing multiple headers that just say "candidates" when there are >1 ballots without SOPN yet. --- postcode_lookup/templates/includes/ballots.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/postcode_lookup/templates/includes/ballots.html b/postcode_lookup/templates/includes/ballots.html index 29fb2bc..86fa506 100644 --- a/postcode_lookup/templates/includes/ballots.html +++ b/postcode_lookup/templates/includes/ballots.html @@ -27,8 +27,8 @@

{% else %} - {% trans sopn_date=section.context.sopn_publish_date|date_filter %} -

Candidates

+ {% trans sopn_date=section.context.sopn_publish_date|date_filter, election_name=ballot.election_name %} +

{{ election_name }} candidates

The list of candidates for this election will be published after {{ sopn_date }}.

{% endtrans %} {% endif %} From 42815c78ae7c1e1a44df155fa5722332f98e5866 Mon Sep 17 00:00:00 2001 From: chris48s Date: Wed, 30 Oct 2024 13:43:13 +0000 Subject: [PATCH 3/3] move id to container div this allows the href="#target" links to work whether there is a SOPN yet or not --- .../templates/includes/ballots.html | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/postcode_lookup/templates/includes/ballots.html b/postcode_lookup/templates/includes/ballots.html index 86fa506..5d3258e 100644 --- a/postcode_lookup/templates/includes/ballots.html +++ b/postcode_lookup/templates/includes/ballots.html @@ -1,37 +1,39 @@ {% for ballot in date.date_data.ballots %}
- {% if ballot.cancelled %} - {% include 'includes/cancellation_reasons.html' %} - {% else %} - {% if ballot.candidates_verified and section.context.show_candidates %} -
- {{ ballot.election_name }} candidates - {{ additional_ballot_link(request, ballot) }} -
    - {% if ballot.voting_system.uses_party_lists %} - {% for party_name, candidates in ballot.candidates|groupby('party.party_name') %} -
  1. {{ party_name }} ({{ candidates|length }} candidates)
  2. - {% endfor %} - {% else %} - {% for candidate in ballot.candidates %} -
  3. - {{ candidate.person.name }}
    - {{ candidate.party.party_name }} -
  4. - {% endfor %} - {% endif %} +
    + {% if ballot.cancelled %} + {% include 'includes/cancellation_reasons.html' %} + {% else %} + {% if ballot.candidates_verified and section.context.show_candidates %} +
    + {{ ballot.election_name }} candidates + {{ additional_ballot_link(request, ballot) }} +
      + {% if ballot.voting_system.uses_party_lists %} + {% for party_name, candidates in ballot.candidates|groupby('party.party_name') %} +
    1. {{ party_name }} ({{ candidates|length }} candidates)
    2. + {% endfor %} + {% else %} + {% for candidate in ballot.candidates %} +
    3. + {{ candidate.person.name }}
      + {{ candidate.party.party_name }} +
    4. + {% endfor %} + {% endif %} -
    -

    - Find out more about the candidates in your area on WhoCanIVoteFor.co.uk -

    -
    - {% else %} - {% trans sopn_date=section.context.sopn_publish_date|date_filter, election_name=ballot.election_name %} -

    {{ election_name }} candidates

    -

    The list of candidates for this election will be published after {{ sopn_date }}.

    - {% endtrans %} - {% endif %} - {% endif %} +
+

+ Find out more about the candidates in your area on WhoCanIVoteFor.co.uk +

+
+ {% else %} + {% trans sopn_date=section.context.sopn_publish_date|date_filter, election_name=ballot.election_name %} +

{{ election_name }} candidates

+

The list of candidates for this election will be published after {{ sopn_date }}.

+ {% endtrans %} + {% endif %} + {% endif %} +
{% endfor %}