e3ecbfcab75a8c267f67bbabbfddf1d348d522cc
[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 (session.user and 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 %}
36 <a href="#delete" data-toggle="modal" class="btn btn-danger btn-mini" title="Supprimer"><i class="icon-remove icon-white"></i></a>
37 <div class="modal hide fade" id="delete">
38 <div class="modal-header">
39 <button type="button" class="close" data-dismiss="modal">×</button>
40 <h3>Suppression de votre vote</h3>
41 </div>
42 <div class="modal-body">
43 <p>Voulez-vous vraiment supprimer votre vote ?</p>
44 </div>
45 <div class="modal-footer">
46 <a href="{{ url_for('vote_deletechoices', idvote=vote.id, iduser=session.user.id) }}" class="btn btn-danger">Confirmer</a>
47 <a href="#" class="btn" data-dismiss="modal">Annuler</a>
48 </div>
49 </div>
50 {% endif %}</td>
51 {% endif %}
52 </tr>
53 {% endif %}
54 {% endfor %}
55
56 {% if can_vote %}
57 <form class="form-inline" action="{{ url_for('vote', idvote=vote.id) }}" method="post">
58 <tr>
59 <th><input type='text' name="username" value='{{ session.user.name }}' disabled /></th>
60 {% if vote.is_multiplechoice %}
61 {% for choice in choices %}
62 <td><input type='checkbox' name="{{ choice.id }}" value="{{ choice.id }}" /></td>
63 {% endfor %}
64 {% else %}
65 {% for choice in choices %}
66 <td><input type='radio' name="choice" value="{{ choice.id }}" /></td>
67 {% endfor %}
68 {% endif %}
69 <td><input type="submit" class="btn btn-primary" value="OK" /></td>
70 </tr>
71 </form>
72 {% endif %}
73 </tbody>
74
75 <tfoot>
76 {% if vote.is_transparent %}
77 <tr>
78 <th>Somme</th>
79 {% for choice in choices %}
80 <td>{{ choice.nb }}</td>
81 {% endfor %}
82 {% if 'user' in session %}
83 <td></td>
84 {% endif %}
85 </tr>
86 {% endif %}
87 </tfoot>
88 </table>
89 </div>
90
91 <div class="span3">
92 <h3>Informations</h3>
93 {% if vote.nb_votes == 0 %}
94 <div class="progress progress-striped progress-danger">
95 <div class="bar" style="width: 100%;"><strong>{{ vote.nb_votes }} / {{ vote.max_votes }}</strong></div>
96 </div>
97 {% else %}
98 <div class="progress progress-striped {% if vote.nb_votes == vote.max_votes %}progress-success{% endif %}">
99 <div class="bar" style="width: {{ vote.percent }}%;"><strong>{{ vote.nb_votes }} / {{ vote.max_votes }}</strong></div>
100 </div>
101 {% endif %}
102 <dl class="dl-horizontal">
103 <dt>Publié par <dd><code>{{ vote.author }}</code>
104 <dt>Début le <dd><code>{{ vote.date_begin }}</code>
105 <dt>Deadline le <dd><code>{{ vote.date_end }}</code>
106 <dt>Groupe <dd><code>{{ vote.groupname }}</code>
107 <dt>Catégorie <dd><code>{{ vote.category }}</code>
108 </dl>
109 <dl>
110 {% if vote.description %}
111 <dt>Description : <dd>{{ vote.description }}
112 {% endif %}
113 {% if attachments %}
114 <dt>Documents :<dd>
115 <ul>
116 {% for attachment in attachments %}
117 <li><a href="{{ attachment.url }}">{{ attachment.url }}</a></li>
118 {% endfor %}
119 </ul>
120 {% endif %}
121 </dl>
122 </div>
123
124 </div>
125 {% endblock %}
126