bgneal@447: {% extends 'base.html' %}
bgneal@447: {% load url from future %}
bgneal@447: {% load comment_tags %}
bgneal@447: {% load script_tags %}
bgneal@447: {% block title %}Poll Results: {{ poll.question }}{% endblock %}
bgneal@447: {% block custom_css %}
bgneal@447: <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/polls.css" />
bgneal@449: <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/comments.css" />
bgneal@447: {% endblock %}
bgneal@447: {% block custom_js %}
bgneal@447: {% if poll.is_open %}
bgneal@447: {% script_tags "markitup jquery-ui" %}
bgneal@447: <script type="text/javascript" src="{{ STATIC_URL }}js/comments.js"></script>
bgneal@447: {% endif %}
bgneal@447: {% endblock %}
bgneal@447: {% block content %}
bgneal@447: <h2>Polls</h2>
bgneal@447: <h3>Results for: {{ poll.question }}</h3>
bgneal@447: <dl class="poll-result">
bgneal@447: {% for choice in choices %}
bgneal@447:    <dt>{{ choice.choice }} - {{ choice.pct|floatformat }}% ({{ choice.votes }} vote{{ choice.votes|pluralize }})</dt>
bgneal@447:    <dd>
bgneal@447:       <div class="poll-percent" style="width: {{ choice.pct|floatformat:0 }}%; background-color: teal; color: white;">
bgneal@447:          <span>&nbsp;</span></div>
bgneal@447:    </dd>
bgneal@447: {% endfor %}
bgneal@447: </dl>
bgneal@447: <p><strong>{{ total_votes }} total vote{{ total_votes|pluralize }}.</strong></p>
bgneal@447: 
bgneal@447: {% if user_choice %}
bgneal@447: <p>You voted for &quot;{{ user_choice.choice }}&quot;.</p>
bgneal@447: {% endif %}
bgneal@447: 
bgneal@447: <p>
bgneal@447: {% if poll.is_open %}
bgneal@447: Voting for this poll started on {{ poll.start_date|date:"F d, Y" }}. 
bgneal@447:    {% if poll.end_date %}
bgneal@447:       Voting will end on {{ poll.end_date|date:"F d, Y" }}.
bgneal@447:    {% endif %}
bgneal@447: {% else %}
bgneal@447: This poll ran from {{ poll.start_date|date:"F d, Y" }} to {{ poll.end_date|date:"F d, Y" }}.
bgneal@447: {% endif %}
bgneal@447: </p>
bgneal@447: 
bgneal@447: <p class="poll-nav">
bgneal@447: {% if poll.is_open and user.is_authenticated %}
bgneal@448: <a href="{% url 'polls-vote' poll_id=poll.id %}">Vote</a> |
bgneal@447: {% endif %}
bgneal@448: <a href="{% url 'polls-main' %}">All Polls</a>
bgneal@447: </p>
bgneal@447: 
bgneal@447: {% get_comment_count for poll as comment_count %}
bgneal@447: <p>This poll has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.</p>
bgneal@447: <hr />
bgneal@447: {% render_comment_list poll %}
bgneal@447: {% if poll.is_open %}
bgneal@447: <p>Leave a comment?</p>
bgneal@447: {% render_comment_form for poll %}
bgneal@447: {% else %}
bgneal@447: <p>Comments are closed for this poll. If you'd like to share your thoughts on this poll 
bgneal@447: with the site staff, you can <a href="{% url 'contact-form' %}">contact us directly</a>.</p>
bgneal@447: {% endif %}
bgneal@447: {% endblock %}