vote.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 (session.user and 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 %}
  34. <a href="#delete" data-toggle="modal" class="btn btn-danger btn-mini" title="Supprimer"><i class="icon-remove icon-white"></i></a>
  35. <div class="modal hide fade" id="delete">
  36. <div class="modal-header">
  37. <button type="button" class="close" data-dismiss="modal">×</button>
  38. <h3>Suppression de votre vote</h3>
  39. </div>
  40. <div class="modal-body">
  41. <p>Voulez-vous vraiment supprimer votre vote ?</p>
  42. </div>
  43. <div class="modal-footer">
  44. <a href="{{ url_for('vote_deletechoices', idvote=vote.id, iduser=session.user.id) }}" class="btn btn-danger">Confirmer</a>
  45. <a href="#" class="btn" data-dismiss="modal">Annuler</a>
  46. </div>
  47. </div>
  48. {% endif %}</td>
  49. {% endif %}
  50. </tr>
  51. {% endif %}
  52. {% endfor %}
  53. {% if can_vote %}
  54. <form class="form-inline" action="{{ url_for('vote', idvote=vote.id) }}" method="post">
  55. <tr>
  56. <th><input type='text' name="username" value='{{ session.user.name }}' disabled /></th>
  57. {% if vote.is_multiplechoice %}
  58. {% for choice in choices %}
  59. <td><input type='checkbox' name="{{ choice.id }}" value="{{ choice.id }}" /></td>
  60. {% endfor %}
  61. {% else %}
  62. {% for choice in choices %}
  63. <td><input type='radio' name="choice" value="{{ choice.id }}" /></td>
  64. {% endfor %}
  65. {% endif %}
  66. <td><input type="submit" class="btn btn-primary" value="OK" /></td>
  67. </tr>
  68. </form>
  69. {% endif %}
  70. </tbody>
  71. <tfoot>
  72. {% if vote.is_transparent %}
  73. <tr>
  74. <th>Somme</th>
  75. {% for choice in choices %}
  76. <td>{{ choice.nb }}</td>
  77. {% endfor %}
  78. {% if 'user' in session %}
  79. <td></td>
  80. {% endif %}
  81. </tr>
  82. {% endif %}
  83. </tfoot>
  84. </table>
  85. </div>
  86. <div class="span3">
  87. <h3>Informations</h3>
  88. {% if vote.nb_votes == 0 %}
  89. <div class="progress progress-striped progress-danger">
  90. <div class="bar" style="width: 100%;"><strong>{{ vote.nb_votes }} / {{ vote.max_votes }}</strong></div>
  91. </div>
  92. {% else %}
  93. <div class="progress progress-striped {% if vote.nb_votes == vote.max_votes %}progress-success{% endif %}">
  94. <div class="bar" style="width: {{ vote.percent }}%;"><strong>{{ vote.nb_votes }} / {{ vote.max_votes }}</strong></div>
  95. </div>
  96. {% endif %}
  97. <dl class="dl-horizontal">
  98. <dt>Publié par <dd><code>{{ vote.author }}</code>
  99. <dt>Début le <dd><code>{{ vote.date_begin }}</code>
  100. <dt>Deadline le <dd><code>{{ vote.date_end }}</code>
  101. <dt>Groupe <dd><code>{{ vote.groupname }}</code>
  102. <dt>Catégorie <dd><code>{{ vote.category }}</code>
  103. </dl>
  104. <dl>
  105. {% if vote.description %}
  106. <dt>Description : <dd>{{ vote.description }}
  107. {% endif %}
  108. {% if attachments %}
  109. <dt>Documents :<dd>
  110. <ul>
  111. {% for attachment in attachments %}
  112. <li><a href="{{ attachment.url }}">{{ attachment.url }}</a></li>
  113. {% endfor %}
  114. </ul>
  115. {% endif %}
  116. </dl>
  117. </div>
  118. </div>
  119. {% endblock %}