add comments support
[cavote.git] / templates / vote.html
index d767473..5d1e4c6 100644 (file)
 <table class="table table-condensed table-bordered table-votes cardinal-{{ vote.id_cardinal }}">
   <thead>
     <tr>
-      <th></th>
+      <th class="users">Votant-e-s</th>
       {% for choice in choices %}
       <th class="choice-name">{{ choice.name }}</th>
       {% endfor %}
       {% if 'user' in session and (can_vote or (not vote['is_terminated'] and not vote['is_anonymous'])) %}
       <th></th>
+      {% else %}
+      <th class="comments">Commentaires</th>
       {% endif %}
     </tr>
   {% if vote.is_transparent %}
         </select>
       </td>
       {% endfor %}
-      <td><input type="submit" class="btn btn-primary" value="OK" /></td>
+      <td><input type="submit" class="btn btn-primary" value="OK" />
+          <textarea name="comment" class="input-xlarge" placeholder="Commentaire"></textarea></td>
     </tr>
     </form>
   {% endif %}
       <td class="{{user.choices[choice.id].class}}"><span>{{ user.choices[choice.id].name }}</span></td>
       {% endfor %}
       {% if 'user' in session and (can_vote or (not vote['is_terminated'] and not vote['is_anonymous'])) %}
-      <td>{% if user.userid == session.user.id %}
+      <td class="ok">{% if user.userid == session.user.id %}
         <a href="#delete" data-toggle="modal" class="btn btn-danger btn-mini" title="Supprimer"><i class="icon-remove icon-white"></i></a>
         <div class="modal hide fade" id="delete">
           <div class="modal-header">
             <a href="#" class="btn" data-dismiss="modal">Annuler</a>
           </div>
         </div>
-      {% endif %}</td>
+        {% endif %}
+        <span class="comment">{% if user.comment %}{{user.comment}}{%endif%}</span>
+      </td>
+      {% else %}
+      <td class="ok">
+        <span class="comment">{% if user.comment %}{{user.comment}}{%endif%}</span>
+      </td>
       {% endif %}
     </tr>
   {% endif %}
 {% endif %}
 </div>
 
+{% if vote.is_anonymous %}
+<div class="span9">
+  <h2 class='page-header'>Commentaires</h2>
+  <table class="table table-condensed table-bordered table-comments">
+    <tbody>
+      {% for user in users %}
+      <tr><td><span class="comment">{% if user.comment %}{{user.comment}}{%endif%}</span></td></tr>
+      {% endfor %}
+    </tbody>
+  </table>
+{% endif %}
+
 </div>
 {% endblock %}