annotate gpp/templates/polls/poll_results.html @ 439:1f139de929c4

Fixing #216; added anti-ballot stuffing feature to the polls application.
author Brian Neal <bgneal@gmail.com>
date Sat, 21 May 2011 19:55:48 +0000
parents 88b2b9cb8c1f
children
rev   line source
gremmie@1 1 {% extends 'base.html' %}
bgneal@310 2 {% load url from future %}
gremmie@1 3 {% load comment_tags %}
bgneal@6 4 {% load script_tags %}
gremmie@1 5 {% block title %}Poll Results: {{ poll.question }}{% endblock %}
gremmie@1 6 {% block custom_css %}
bgneal@312 7 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/polls.css" />
bgneal@312 8 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/comments.css" />
gremmie@1 9 {% endblock %}
gremmie@1 10 {% block custom_js %}
bgneal@6 11 {% if poll.is_open %}
bgneal@127 12 {% script_tags "markitup jquery-ui" %}
bgneal@312 13 <script type="text/javascript" src="{{ STATIC_URL }}js/comments.js"></script>
bgneal@6 14 {% endif %}
gremmie@1 15 {% endblock %}
gremmie@1 16 {% block content %}
gremmie@1 17 <h2>Polls</h2>
bgneal@439 18 <h3>Results for: {{ poll.question }}</h3>
gremmie@1 19 <dl class="poll-result">
gremmie@1 20 {% for choice in choices %}
gremmie@1 21 <dt>{{ choice.choice }} - {{ choice.pct|floatformat }}% ({{ choice.votes }} vote{{ choice.votes|pluralize }})</dt>
gremmie@1 22 <dd>
gremmie@1 23 <div class="poll-percent" style="width: {{ choice.pct|floatformat:0 }}%; background-color: teal; color: white;">
gremmie@1 24 <span>&nbsp;</span></div>
gremmie@1 25 </dd>
gremmie@1 26 {% endfor %}
gremmie@1 27 </dl>
gremmie@1 28 <p><strong>{{ total_votes }} total vote{{ total_votes|pluralize }}.</strong></p>
bgneal@439 29
bgneal@439 30 {% if user_choice %}
bgneal@439 31 <p>You voted for &quot;{{ user_choice.choice }}&quot;.</p>
bgneal@439 32 {% endif %}
bgneal@439 33
gremmie@1 34 <p class="poll-nav">
gremmie@1 35 <a href="{{ poll.get_absolute_url }}">Poll Details</a>
gremmie@1 36 {% if poll.is_open and user.is_authenticated %}
bgneal@439 37 | <a href="{% url 'polls-vote' poll_id=poll.id %}">Vote</a>
gremmie@1 38 {% endif %}
bgneal@439 39 | <a href="{% url 'polls-main' %}">All Polls</a>
gremmie@1 40 </p>
gremmie@1 41
gremmie@1 42 {% get_comment_count for poll as comment_count %}
gremmie@1 43 <p>This poll has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.</p>
gremmie@1 44 <hr />
gremmie@1 45 {% render_comment_list poll %}
gremmie@1 46 {% if poll.is_open %}
gremmie@1 47 <p>Leave a comment?</p>
gremmie@1 48 {% render_comment_form for poll %}
gremmie@1 49 {% else %}
gremmie@1 50 <p>Comments are closed for this poll. If you'd like to share your thoughts on this poll
bgneal@310 51 with the site staff, you can <a href="{% url 'contact-form' %}">contact us directly</a>.</p>
gremmie@1 52 {% endif %}
gremmie@1 53 {% endblock %}