aboutsummaryrefslogtreecommitdiffstats
path: root/templates/poll_vote_list.html.j2
blob: c62c102bb3b64cd49e27919e5d2c6e18a98fff5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<form action="/poll/{{ poll.id }}/vote" method="post">
  <div class="vote-list">
    {% for choice in choices %}
    <div {% if choice.id in most_voted_choice_ids %}class="most-voted"{% endif %}>
      <label for="choice_{{ choice.id }}">
        <input type="checkbox" name="choice_{{ choice.id }}" id="choice_{{ choice.id }}">
        <strong>
          {% include "poll_choice_datetime_range.html.j2" %}
        </strong>
        <span>
          {% if choice.id in most_voted_choice_ids %}👑{% endif %}
          <i>{{ choice.votes_with_value(1) | length }}&nbsp;votes</i>
        </span>
        <div>
          {% if choice.votes_with_value(1) | length != 0 %}
          Voted by: {% for vote in choice.votes_with_value(1) %}
          {{ vote.voter_name }}{% if not loop.last %}, {% endif %}
          {% endfor %}
          {% endif %}
        </div>
      </label>
    </div>
    <p></p>
    {% endfor %}
  </div>

  <div>
    <label for="voter_name" hidden>Your name</label>
    <input type="text" name="voter_name" placeholder="Your name" required
           {% if prefill_voter_name %}value="{{ prefill_voter_name }}"{% endif %}>
    <input class="green" type="submit" value="Submit">
  </div>
</form>

{% if managed_voter_names | length != 0 %}
<br>
<br>
<h3>Remove submission(s)</h3>
{% endif %}
<div>
  {% for voter_name in managed_voter_names %}
  <form action="/poll/{{ poll.id }}/delete_voter" method="post">
    <input type="hidden" name="voter_code" value="{{ managed_voter_names[voter_name] }}">
    {{ voter_name }}
    <input class="delete-voter-btn" type="submit" value="❌">
  </form>
  {% endfor %}
</div>