Coverage for gui/templates/gui/ballot_admin.html: 100%

71 statements  

« prev     ^ index     » next       coverage.py v7.2.1, created at 2023-03-14 06:24 +0000

1{% extends 'gui/base.html' %} 

2  

3{% load bootstrap3 %} 

4{% load static %} 

5  

6{% block content %} 

7 <script src="{% static 'js/sorttable.js' %}"></script> 

8  

9 <h1>Admin view for the ballot '{{ballot.short_name}}'</h1> 

10  

11 <div class="panel panel-default" > 

12 <div class="panel-heading">Ballot description</div> 

13 <div class="panel-body"> 

14 {{ballot.description|safe|linebreaks}} 

15 </div> 

16 </div> 

17  

18 <div class="panel panel-default" > 

19 <div class="panel-heading">Ballot Statistics</div> 

20 <div class="panel-body"> 

21 Turnout: {{ballot.turnout}} 

22  

23 {% if ballot.has_started and not ballot.has_closed %} 

24 <form action="{% url 'ballot-send-reminder' ballot.id %}" method="post"> 

25 {% csrf_token %} 

26 <div class="form-group"> 

27 <button type="submit" class="btn btn-danger pull-right{% if ballot.turnout.count == ballot.turnout.total %} disabled{% endif %}">Send reminder</button> 

28 </div> 

29 </form> 

30 {% endif %} 

31 </div> 

32 </div> 

33  

34 {% if not ballot.has_closed %} 

35 <div class="panel panel-danger" > 

36 <div class="panel-heading">Ballot Results</div> 

37 <div class="panel-body"> 

38 The ballot is not yet closed, and thus results cannot be presented yet. 

39 </div> 

40 </div> 

41 {% else %} 

42 {% for select in ballot.select_questions.all %} 

43 <div class="panel panel-default" > 

44 <div class="panel-heading">Select: {{select.question}}</div> 

45 <div class="panel-body"> 

46 <table class="table table-condensed table-striped table-hover table-bordered sortable"> 

47 <tr> 

48 <th>Answer</th><th>Votes</th> 

49 </tr> 

50 {% for answer, count in select.tally.items %} 

51 <tr><td>{{answer.answer}}</td><td sorttable_customkey="{{count.percentage}}">{{count}}</td></tr> 

52 {% endfor %} 

53 </table> 

54  

55 </div> 

56 </div> 

57 {% endfor %} 

58  

59 {% for ranking in ballot.ranking_questions.all %} 

60 <div class="panel panel-default" > 

61 <div class="panel-heading">Ranking: {{ranking.question}}</div> 

62 <div class="panel-body"> 

63 <table class="table table-condensed table-striped table-hover table-bordered sortable"> 

64 <tr> 

65 <th>Option</th>{% for rank in ranking.possible_options.all %}<th>Rank {{ forloop.counter }}</th>{% endfor %}<th>Final Score</th> 

66 </tr> 

67 {% for votes in ranking.tally %} 

68 <tr><td>{{votes.ranking_option.option}}</td>{% for count in votes.count_by_rank %}<td>{{ count }}</td>{% endfor %}<td ><strong>{{votes.score}}</strong></td></tr> 

69 {% endfor %} 

70 </table> 

71  

72 </div> 

73 </div> 

74 {% endfor %} 

75 {% endif %} 

76  

77{% endblock %}