Users can see waiting votes, votes can be terminated
[cavote.git] / templates / vote.html
1 {% extends "layout.html" %}
2 {% block body %}
3 <div class="row">
4 <div class="span9">
5 <h2 class='page-header'>{{ vote.title }}</h2>
6 {% if not vote.is_transparent %}
7 <div class="alert alert-info">Ce sondage n'est pas transparent, vous ne pouvez pas voir les votes des autres.</div>
8 {% endif %}
9
10 <table class="table table-condensed table-bordered table-votes">
11 <thead>
12 <tr>
13 <th></th>
14 {% for choice in choices %}
15 <th>{{ choice.name }}</th>
16 {% endfor %}
17 {% if 'user' in 'session' %}
18 <th></th>
19 {% endif %}
20 </tr>
21 </thead>
22
23 <tbody>
24 {% for user in users %}
25 {% if vote.is_transparent or user.userid == session.user.id %}
26 <tr>
27 <th>{% if 'user' in session and user.userid == session.user.id %}<i class="icon-user"></i>{% endif %} {{ user.username }}</th>
28 {% for choice in choices %}
29 {% if choice.id in user.choices %}
30 <td class="yes"><i class="icon-ok icon-white"></i></td>
31 {% else %}
32 <td class="no"></td>{% endif %}
33 {% endfor %}
34 {% if 'user' in 'session' %}
35 <td>{% if user.userid == session.user.id %}<a href="{{ url_for('vote_deletechoices', idvote=vote.id, iduser=session.user.id) }}" class="btn btn-mini btn-danger" title="Supprimer"><i class="icon-remove icon-white"></a>{% endif %}</td>
36 {% endif %}
37 </tr>
38 {% endif %}
39 {% endfor %}
40
41 {% if can_vote %}
42 <form class="form-inline" action="{{ url_for('vote', idvote=vote.id) }}" method="post">
43 <tr>
44 <th><input type='text' name="username" value='{{ session.user.name }}' disabled /></th>
45 {% if vote.is_multiplechoice %}
46 {% for choice in choices %}
47 <td><input type='checkbox' name="{{ choice.id }}" /></td>
48 {% endfor %}
49 {% else %}
50 {% for choice in choices %}
51 <td><input type='radio' name="{{ choice.id }}" /></td>
52 {% endfor %}
53 {% endif %}
54 <td><input type="submit" class="btn btn-primary" value="OK" /></td>
55 </tr>
56 </form>
57 {% endif %}
58 </tbody>
59
60 <tfoot>
61 {% if vote.is_transparent %}
62 <tr>
63 <th>Somme</th>
64 {% for choice in choices %}
65 <td>{{ choice.nb }}</td>
66 {% endfor %}
67 {% if 'user' in 'session' %}
68 <td></td>
69 {% endif %}
70 </tr>
71 {% endif %}
72 </tfoot>
73 </table>
74 </div>
75
76 <div class="span3">
77 <h3>Informations</h3>
78 <strong>Avancement : </strong> {{ vote.nb_votes }} / {{ vote.max_votes }}
79 <div class="progress progress-striped {% if vote.nb_votes == vote.max_votes %}progress-success{% endif %}">
80 <div class="bar" style="width: {{ vote.percent }}%;"></div>
81 </div>
82 <dl class="dl-horizontal">
83 <dt>Publié par <dd><code>maethor</code>
84 <dt>Début le <dd><code>{{ vote.date_begin }}</code>
85 <dt>Deadline le <dd><code>{{ vote.date_end }}</code>
86 <dt>Groupe <dd><code>{{ vote.groupname }}</code>
87 <dt>Catégorie <dd><code>{{ vote.category }}</code>
88 </dl>
89 <dl>
90 <dt>Description : <dd>{{ vote.description }}
91 <dt>Documents :<dd>
92 <ul>
93 {% for attachment in attachments %}
94 <li><a href="{{ attachment.url }}">{{ attachment.url }}</a></li>
95 {% endfor %}
96 </ul>
97 </li>
98 </dl>
99 </div>
100
101 </div>
102 {% endblock %}
103