Nb votes and max votes displayed in progress bar
[cavote.git] / templates / vote.html
index 8c0f3e1..c787420 100644 (file)
       <th><input type='text' name="username" value='{{ session.user.name }}' disabled /></th>
       {% if vote.is_multiplechoice %}
       {% for choice in choices %}
-      <td><input type='checkbox' name="{{ choice.id }}" /></td>
+      <td><input type='checkbox' name="{{ choice.id }}" value="{{ choice.id }}" /></td>
       {% endfor %}
       {% else %}
       {% for choice in choices %}
-      <td><input type='radio' name="{{ choice.id }}" /></td>
+      <td><input type='radio' name="choice" value="{{ choice.id }}" /></td>
       {% endfor %}
       {% endif %}
       <td><input type="submit" class="btn btn-primary" value="OK" /></td>
 
 <div class="span3">
 <h3>Informations</h3>
-<strong>Avancement : </strong> {{ vote.nb_votes }} / {{ vote.max_votes }}
+{% if vote.nb_votes == 0 %}
+<div class="progress progress-striped progress-danger">
+  <div class="bar" style="width: 100%;"><strong>{{ vote.nb_votes }} / {{ vote.max_votes }}</strong></div>
+</div>
+{% else %}
 <div class="progress progress-striped {% if vote.nb_votes == vote.max_votes %}progress-success{% endif %}">
-  <div class="bar" style="width: {{ vote.percent }}%;"></div>
+  <div class="bar" style="width: {{ vote.percent }}%;"><strong>{{ vote.nb_votes }} / {{ vote.max_votes }}</strong></div>
 </div>
+{% endif %}
 <dl class="dl-horizontal">
   <dt>Publié par <dd><code>maethor</code>
   <dt>Début le <dd><code>{{ vote.date_begin }}</code>