add comments support
[cavote.git] / templates / vote.html
index 7e36224..5d1e4c6 100644 (file)
 <div class="span8">
   <h2 class='page-header'>Résultats</h2>
   <svg class="results cardinal-{{ vote.id_cardinal }}"
-       width="{{ 150 + (100 * 5) + 50 + 100 + 100 }}"
+       width="{{ 150 + (100 * 5) + 100 + 100 }}"
        height="{{25 + results.list|length * 20 + 40}}">
     <g class="choice" transform="translate(100,0)">
       <text class="choice-legend" x="-10" y="9.5" dy=".35em">Légende :</text>
+      {% for value in values %}
+      <g transform="translate({{ (loop.index0 * 750 / loop.length) }},0)">
+        <rect width="{{ 750 / loop.length + 1 }}" height="18"></rect>
+        <rect class="{{ value.class }}" x="1" y ="0" width="{{ 750 / loop.length - 1}}" height="18"></rect>
+        <text class="choice-legend-item" text-anchor="start" x="{{ 750 / loop.length - 2 }}" y="9.5" dy=".35em"
+         >{{ value.name }}</text>
+       </g>
+      {% endfor %}
      </g>
-    {% for value in values %}
-    <g transform="translate({{ 150 + (loop.index0 * 640 / loop.length) }},0)">
-      <rect width="{{ 640 / loop.length + 1 }}" height="18"></rect>
-      <rect class="{{ value.class }}" x="1" y ="0" width="{{ 640 / loop.length - 1}}" height="18"></rect>
-      <text class="choice-legend-item" text-anchor="start" x="{{ 640 / loop.length - 2 }}" y="9.5" dy=".35em"
-       >{{ value.name }}</text>
-     </g>
-    {% endfor %}
     <g transform="translate({{150 + (100 * 5) + 35}},20)">
       <text class="choice-sum-legend" x="20" y="9.5" dy=".35em">somme↓</text>
      </g>
 <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 %}