Users can vote
[cavote.git] / templates / vote.html
index 30602cb..fd93e5b 100644 (file)
 
   <tbody>
   {% if vote.is_transparent %}
-  <!-- :TODO:maethor:20120528: Afficher les votes ici -->
+  {% for user in users %}
+    <tr>
+      <td>{{ user.username }}</td>
+      {% for choice in choices %}
+      <th>{% if choice in user.choices %}OUI{% else %}NON{% endif %}</th>
+      {% endfor %}
+    </tr>
+  {% endfor %}
   {% else %}
     <div class="alert alert-info">Ce sondage n'est pas transparent, vous ne pouvez pas voir les votes des autres.</div>
     <!-- :TODO:maethor:20120528: Afficher le vote de l'utilisateur -->
   {% endif %}
 
   {% if can_vote %}
-    <form class="form-inline" action=""> <!-- :TODO:maethor:20120528: Route -->
+    <form class="form-inline" action="{{ url_for('vote', idvote=vote.id) }}" method="post">
     <tr>
       <td><input type='text' name="username" value='{{ session.user.name }}' disabled /></td>
       {% if vote.is_multiple %}
@@ -32,7 +39,7 @@
       {% endfor %}
       {% else %}
       {% for choice in choices %}
-      <td><input type='radio' name="choice" value="{{ choice.id }}" /></td>
+      <td><input type='radio' name="{{ choice.id }}" /></td>
       {% endfor %}
       {% endif %}
       <td><input type="submit" class="btn btn-primary" value="OK" /></td>