bgneal@447
|
1 {% extends 'base.html' %}
|
bgneal@447
|
2 {% load url from future %}
|
bgneal@447
|
3 {% load comment_tags %}
|
bgneal@447
|
4 {% load script_tags %}
|
bgneal@447
|
5 {% block title %}Poll Results: {{ poll.question }}{% endblock %}
|
bgneal@447
|
6 {% block custom_css %}
|
bgneal@447
|
7 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/polls.css" />
|
bgneal@447
|
8 {% endblock %}
|
bgneal@447
|
9 {% block custom_js %}
|
bgneal@447
|
10 {% if poll.is_open %}
|
bgneal@447
|
11 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/comments.css" />
|
bgneal@447
|
12 {% script_tags "markitup jquery-ui" %}
|
bgneal@447
|
13 <script type="text/javascript" src="{{ STATIC_URL }}js/comments.js"></script>
|
bgneal@447
|
14 {% endif %}
|
bgneal@447
|
15 {% endblock %}
|
bgneal@447
|
16 {% block content %}
|
bgneal@447
|
17 <h2>Polls</h2>
|
bgneal@447
|
18 <h3>Results for: {{ poll.question }}</h3>
|
bgneal@447
|
19 <dl class="poll-result">
|
bgneal@447
|
20 {% for choice in choices %}
|
bgneal@447
|
21 <dt>{{ choice.choice }} - {{ choice.pct|floatformat }}% ({{ choice.votes }} vote{{ choice.votes|pluralize }})</dt>
|
bgneal@447
|
22 <dd>
|
bgneal@447
|
23 <div class="poll-percent" style="width: {{ choice.pct|floatformat:0 }}%; background-color: teal; color: white;">
|
bgneal@447
|
24 <span> </span></div>
|
bgneal@447
|
25 </dd>
|
bgneal@447
|
26 {% endfor %}
|
bgneal@447
|
27 </dl>
|
bgneal@447
|
28 <p><strong>{{ total_votes }} total vote{{ total_votes|pluralize }}.</strong></p>
|
bgneal@447
|
29
|
bgneal@447
|
30 {% if user_choice %}
|
bgneal@447
|
31 <p>You voted for "{{ user_choice.choice }}".</p>
|
bgneal@447
|
32 {% endif %}
|
bgneal@447
|
33
|
bgneal@447
|
34 <p>
|
bgneal@447
|
35 {% if poll.is_open %}
|
bgneal@447
|
36 Voting for this poll started on {{ poll.start_date|date:"F d, Y" }}.
|
bgneal@447
|
37 {% if poll.end_date %}
|
bgneal@447
|
38 Voting will end on {{ poll.end_date|date:"F d, Y" }}.
|
bgneal@447
|
39 {% endif %}
|
bgneal@447
|
40 {% else %}
|
bgneal@447
|
41 This poll ran from {{ poll.start_date|date:"F d, Y" }} to {{ poll.end_date|date:"F d, Y" }}.
|
bgneal@447
|
42 {% endif %}
|
bgneal@447
|
43 </p>
|
bgneal@447
|
44
|
bgneal@447
|
45 <p class="poll-nav">
|
bgneal@447
|
46 {% if poll.is_open and user.is_authenticated %}
|
bgneal@447
|
47 <a href="{% url 'polls-vote' poll_id=poll.id %}">Vote</a>
|
bgneal@447
|
48 {% endif %}
|
bgneal@447
|
49 | <a href="{% url 'polls-main' %}">All Polls</a>
|
bgneal@447
|
50 </p>
|
bgneal@447
|
51
|
bgneal@447
|
52 {% get_comment_count for poll as comment_count %}
|
bgneal@447
|
53 <p>This poll has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.</p>
|
bgneal@447
|
54 <hr />
|
bgneal@447
|
55 {% render_comment_list poll %}
|
bgneal@447
|
56 {% if poll.is_open %}
|
bgneal@447
|
57 <p>Leave a comment?</p>
|
bgneal@447
|
58 {% render_comment_form for poll %}
|
bgneal@447
|
59 {% else %}
|
bgneal@447
|
60 <p>Comments are closed for this poll. If you'd like to share your thoughts on this poll
|
bgneal@447
|
61 with the site staff, you can <a href="{% url 'contact-form' %}">contact us directly</a>.</p>
|
bgneal@447
|
62 {% endif %}
|
bgneal@447
|
63 {% endblock %}
|