vote.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. <table class="table table-condensed table-bordered table-votes">
  10. <thead>
  11. <tr>
  12. <th></th>
  13. {% for choice in choices %}
  14. <th>{{ choice.name }}</th>
  15. {% endfor %}
  16. {% if 'user' in session %}
  17. <th></th>
  18. {% endif %}
  19. </tr>
  20. </thead>
  21. <tbody>
  22. {% for user in users %}
  23. {% if vote.is_transparent or user.userid == session.user.id %}
  24. <tr>
  25. <th>{% if 'user' in session and user.userid == session.user.id %}<i class="icon-user"></i>{% endif %} {{ user.username }}</th>
  26. {% for choice in choices %}
  27. {% if choice.id in user.choices %}
  28. <td class="yes"><i class="icon-ok icon-white"></i></td>
  29. {% else %}
  30. <td class="no"></td>{% endif %}
  31. {% endfor %}
  32. {% if 'user' in session %}
  33. <td>{% if user.userid == session.user.id %}<a href="{{ url_for('vote_deletechoices', idvote=vote.id, iduser=session.user.id) }}" class="btn btn-mini btn-danger" title="Supprimer"><i class="icon-remove icon-white"></a>{% endif %}</td>
  34. {% endif %}
  35. </tr>
  36. {% endif %}
  37. {% endfor %}
  38. {% if can_vote %}
  39. <form class="form-inline" action="{{ url_for('vote', idvote=vote.id) }}" method="post">
  40. <tr>
  41. <th><input type='text' name="username" value='{{ session.user.name }}' disabled /></th>
  42. {% if vote.is_multiplechoice %}
  43. {% for choice in choices %}
  44. <td><input type='checkbox' name="{{ choice.id }}" /></td>
  45. {% endfor %}
  46. {% else %}
  47. {% for choice in choices %}
  48. <td><input type='radio' name="{{ choice.id }}" /></td>
  49. {% endfor %}
  50. {% endif %}
  51. <td><input type="submit" class="btn btn-primary" value="OK" /></td>
  52. </tr>
  53. </form>
  54. {% endif %}
  55. </tbody>
  56. <tfoot>
  57. {% if vote.is_transparent %}
  58. <tr>
  59. <th>Somme</th>
  60. {% for choice in choices %}
  61. <td>{{ choice.nb }}</td>
  62. {% endfor %}
  63. {% if 'user' in session %}
  64. <td></td>
  65. {% endif %}
  66. </tr>
  67. {% endif %}
  68. </tfoot>
  69. </table>
  70. </div>
  71. <div class="span3">
  72. <h3>Informations</h3>
  73. <strong>Avancement : </strong> {{ vote.nb_votes }} / {{ vote.max_votes }}
  74. <div class="progress progress-striped {% if vote.nb_votes == vote.max_votes %}progress-success{% endif %}">
  75. <div class="bar" style="width: {{ vote.percent }}%;"></div>
  76. </div>
  77. <dl class="dl-horizontal">
  78. <dt>Publié par <dd><code>maethor</code>
  79. <dt>Début le <dd><code>{{ vote.date_begin }}</code>
  80. <dt>Deadline le <dd><code>{{ vote.date_end }}</code>
  81. <dt>Groupe <dd><code>{{ vote.groupname }}</code>
  82. <dt>Catégorie <dd><code>{{ vote.category }}</code>
  83. </dl>
  84. <dl>
  85. <dt>Description : <dd>{{ vote.description }}
  86. <dt>Documents :<dd>
  87. <ul>
  88. {% for attachment in attachments %}
  89. <li><a href="{{ attachment.url }}">{{ attachment.url }}</a></li>
  90. {% endfor %}
  91. </ul>
  92. </li>
  93. </dl>
  94. </div>
  95. </div>
  96. {% endblock %}