123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- {% extends "cranefly/layout.html" %}
- {% import "cranefly/macros.html" as macros with context %}
- {% block title %}{{ macros.page_title(title=_("Poll Participants"),parent=thread.name) }}{% endblock %}
- {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
- {{ macros.parents_list(parents) }}
- <li><a href="{{ url('thread', thread=thread.pk, slug=thread.slug) }}">{{ thread.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
- <li class="active">{% trans %}Poll Participants{% endtrans %}
- {%- endblock %}
- {% block container %}
- <div class="page-header header-primary">
- <div class="container">
- {{ messages_list(messages) }}
- <ul class="breadcrumb">
- {{ self.breadcrumb() }}</li>
- </ul>
- <h1>{{ poll.question }} <small>{{ thread.name|short_string(42) }}</small></h1>
- <ul class="unstyled header-stats">
- <li><i class="icon-time"></i> {{ poll.start_date|reltimesince }}</a></li>
- <li><i class="icon-user"></i> {% if poll.user_id %}<a href="{{ url('user', user=poll.user_id, username=poll.user_slug) }}">{{ poll.user_name }}</a>{% else %}{{ poll.user_name }}{% endif %}</li>
- <li><i class="icon-tasks"></i> {% if poll.votes %}{% trans votes=poll.votes %}One vote{% pluralize %}{{ votes }} votes{% endtrans %}{% else %}{% trans %}No votes{% endtrans %}{% endif %}</li>
- {% if thread.closed or thread.deleted %}
- <li><i class="icon-lock"></i> {% trans %}Poll has been closed.{% endtrans %}</li>
- {% elif thread.poll.over %}
- <li><i class="icon-calendar"></i> {% trans end=poll.end_date|date %}Poll ended on {{ end }}{% endtrans %}</li>
- {% elif thread.poll.length %}
- <li><i class="icon-calendar"></i> {% trans end=poll.end_date|date %}Poll ends on {{ end }}{% endtrans %}</li>
- {% else %}
- <li><i class="icon-lock"></i> {% trans %}Permanent poll.{% endtrans %}</li>
- {% endif %}
- </ul>
- </div>
- </div>
- <div class="container container-primary">
- <div class="poll-votes-list">
- {% for option in options %}
- <div class="poll-option">
- <h2>{{ option.name }} <small>
- {% if option.pk in user_votes %}<strong>{% trans %}Your vote{% endtrans %}</strong>{% endif %}
- {% trans votes=option.votes, percent=((option.votes * 100 / poll.votes) if poll.votes else 0)|int -%}
- {{ votes }} vote, {{ percent }}% of all
- {%- pluralize -%}
- {{ votes }} votes, {{ percent }}% of all
- {%- endtrans %}</small></h2>
- {% if option.votes %}
- <table class="table table-striped">
- <tbody>
- {% for row in option.votes_list|batch(4, '') %}
- <tr>
- {% for vote in row %}
- <td class="span3">
- {% if vote %}
- {{ vote_details(vote) }}
- {% else %}
-
- {% endif %}
- </td>
- {% endfor %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
- {% else %}
- <p class="lead">{% trans %}Nobody voted for this option.{% endtrans %}</p>
- {% endif %}
- </div>
- {% if not loop.last %}
- <hr>
- {% endif %}
- {% endfor %}
- </div>
- </div>
- {% endblock %}
- {% block javascripts %}{{ super() }}
- <script type="text/javascript">
- $(function() {
- {% for option in options %}
- {% for vote in option.votes_list %}
- $('.vote-{{ vote.id }}').popover({
- 'placement': 'top',
- 'trigger': 'hover',
- 'html': true,
- {% if acl.users.can_see_users_trails() %}
- 'title': '<strong>{{ vote.date|reldate }}</strong>',
- 'content': '{% trans ip=vote.ip %}From {{ ip }}{% endtrans %}'
- {% else %}
- 'content': '<strong>{{ vote.date|reldate }}</strong>'
- {% endif %}
- });
- {% endfor %}
- {% endfor %}
- });
- </script>
- {% endblock %}
- {% macro vote_details(vote) %}
- {% if vote.user_id %}
- <a href="{{ url('user', user=vote.user_id, username=vote.user_slug) }}" class="vote-user vote-{{ vote.pk }}">{{ vote.user_name }}</a>
- {% else %}
- <span class="vote-user vote-{{ vote.pk }}">{{ vote.user_name }}</span>
- {% endif %}
- {% endmacro %}
|