86b020dab1107a8283645ab91b721f208f4ae023
[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 <th></th>
18 </tr>
19 </thead>
20
21 <tbody>
22 {% for user in users %}
23 {% if vote.is_transparent or user.userid == session.user.id %}
24 <tr>
25 <th>{% if 'user' in session and user.userid == session.user.id %}<i class="icon-user"></i>{% endif %} {{ user.username }}</th>
26 {% for choice in choices %}
27 {% if choice.id in user.choices %}
28 <td class="yes"><i class="icon-ok icon-white"></i></td>
29 {% else %}
30 <td class="no"></td>{% endif %}
31 {% endfor %}
32 <td>{% if 'user' in session and 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>
33 </tr>
34 {% endif %}
35 {% endfor %}
36
37 {% if can_vote %}
38 <form class="form-inline" action="{{ url_for('vote', idvote=vote.id) }}" method="post">
39 <tr>
40 <th><input type='text' name="username" value='{{ session.user.name }}' disabled /></th>
41 {% if vote.is_multiplechoice %}
42 {% for choice in choices %}
43 <td><input type='checkbox' name="{{ choice.id }}" /></td>
44 {% endfor %}
45 {% else %}
46 {% for choice in choices %}
47 <td><input type='radio' name="{{ choice.id }}" /></td>
48 {% endfor %}
49 {% endif %}
50 <td><input type="submit" class="btn btn-primary" value="OK" /></td>
51 </tr>
52 </form>
53 {% endif %}
54 </tbody>
55
56 <tfoot>
57 {% if vote.is_transparent %}
58 <tr>
59 <th>Somme</th>
60 {% for choice in choices %}
61 <td>{{ choice.nb }}</td>
62 {% endfor %}
63 <td></td>
64 </tr>
65 {% endif %}
66 </tfoot>
67 </table>
68 </div>
69
70 <div class="span3">
71 <h3>Informations</h3>
72 <strong>Avancement : </strong> {{ vote.nb_votes }} / {{ vote.max_votes }}
73 <div class="progress progress-striped {% if vote.nb_votes == vote.max_votes %}progress-success{% endif %}">
74 <div class="bar" style="width: {{ vote.percent }}%;"></div>
75 </div>
76 <dl class="dl-horizontal">
77 <dt>Publié par <dd><code>maethor</code>
78 <dt>Début le <dd><code>{{ vote.date_begin }}</code>
79 <dt>Deadline le <dd><code>{{ vote.date_end }}</code>
80 <dt>Groupe <dd><code>{{ vote.groupname }}</code>
81 <dt>Catégorie <dd><code>{{ vote.category }}</code>
82 </dl>
83 <dl>
84 <dt>Description : <dd>{{ vote.description }}
85 <dt>Documents :<dd>
86 <ul>
87 {% for attachment in attachments %}
88 <li><a href="{{ attachment.url }}">{{ attachment.url }}</a></li>
89 {% endfor %}
90 </ul>
91 </li>
92 </dl>
93 </div>
94
95 </div>
96 {% endblock %}
97