admin_vote_edit.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. {% extends "layout.html" %}
  2. {% block body %}
  3. <div class="row">
  4. <div class="span6 well">
  5. <form action="{{ url_for('admin_vote_edit', voteid=vote.id) }}" method="post" class="form-horizontal">
  6. <fieldset><legend>Édition du vote</legend>
  7. <div class="control-group">
  8. <label class="control-label" for="title">Titre</label>
  9. <div class="controls">
  10. <input type="text" size=30 name="title" id="title" value="{{ vote.title }}" />
  11. <span class="help-inline"><font color="red">*</font></span>
  12. </div>
  13. </div>
  14. <div class="control-group">
  15. <label class="control-label" for="description">Description</label>
  16. <div class="controls">
  17. <textarea class="input-xlarge" name="description" id="description">{{ vote.description }}</textarea>
  18. </div>
  19. </div>
  20. <div class="accordion">
  21. <div class="accordion-group">
  22. <div class="accordion-heading">
  23. <a class="accordion-toggle" data-toggle="collapse" href="#infos">+ Informations</a>
  24. </div>
  25. <div id="infos" class="accordion-body collapse">
  26. <div class="accordion-inner">
  27. <div class="control-group">
  28. <label class="control-label" for="category">Catégorie</label>
  29. <div class="controls">
  30. <input type="text" data-provide="typeahead" data-source='["ca","membres"]' size=30 name="category" id="category" value="{{ vote.category }}" />
  31. </div>
  32. </div>
  33. <div class="control-group">
  34. <label class="control-label" for="role">Groupe</label>
  35. <div class="controls">
  36. <select name="role" id="role" disabled>
  37. <option>{{ group.name }}</option>
  38. </select>
  39. <p class="help-block">Groupe d'utilisateur concernés par le vote et ayant le droit de voter</p>
  40. </div>
  41. </div>
  42. <div class="control-group">
  43. <label class="control-label" for="days">Durée (jours)</label>
  44. <div class="controls">
  45. <select class="span1" name="days" id="days">
  46. {% for i in range(1, 31) %}
  47. {% if i == vote.duration %}
  48. <option selected>{{ i }}</option>
  49. {% else %}
  50. <option>{{ i }}</option>
  51. {% endif %}
  52. {% endfor %}
  53. </select>
  54. <span class="help-inline">Du {{ vote.date_begin }} au {{ vote.date_end }}</span>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="accordion-group">
  61. <div class="accordion-heading">
  62. <a class="accordion-toggle" data-toggle="collapse" href="#options">+ Options</a>
  63. </div>
  64. <div id="options" class="accordion-body collapse">
  65. <div class="accordion-inner">
  66. <div class="control-group">
  67. <label class="control-label">Options</label>
  68. <div class="controls">
  69. <label class="checkbox">
  70. <input type="checkbox" name="transparent" {% if vote.is_transparent == 1 %} checked {% endif %} />
  71. Les votants peuvent-ils voir le choix des autres ?
  72. </label>
  73. <label class="checkbox">
  74. <input type="checkbox" name="public" {% if vote.is_public == 1 %} checked {% endif %}/>
  75. Le vote est-il visible par tous ?
  76. </label>
  77. {% if not vote.is_terminated == 1 %}
  78. <label class="checkbox">
  79. <input type="checkbox" name="multiplechoice" {% if vote.is_multiplechoice == 1 %} checked {% endif %} disabled/>
  80. Les votants peuvent-ils choisir plusieurs options ?
  81. </label>
  82. {% endif %}
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="control-group">
  90. <label class="control-label" for="status">Statut</label>
  91. <div class="controls">
  92. <select class="span2" name="status" id="status">
  93. {% if vote.is_terminated == 1 %}
  94. <option>Fermé</option>
  95. <option>Ouvert</option>
  96. <option selected>Terminé</option>
  97. {% else %}
  98. {% if vote.is_open == 1 %}
  99. <option>Fermé</option>
  100. <option selected>Ouvert</option>
  101. <option>Terminé</option>
  102. {% else %}
  103. <option selected>Fermé</option>
  104. <option>Ouvert</option>
  105. {% endif %}
  106. {% endif %}
  107. </select>
  108. </div>
  109. </div>
  110. <div class="form-actions">
  111. <input type="submit" class="btn btn-primary" value="Enregistrer" />
  112. <input type="reset" class="btn" value="Annuler" />
  113. </div>
  114. </fieldset>
  115. </form>
  116. </div>
  117. {% if not vote.is_terminated == 1%}
  118. <div class="span5 well pull-right">
  119. <fieldset><legend>Choix</legend>
  120. <table class="table table-stripped table-condensed">
  121. <thead>
  122. <tr>
  123. <th>Titre
  124. <th>Actions
  125. </tr>
  126. </thead>
  127. <tbody>
  128. {% for choice in choices %}
  129. <tr>
  130. <form action="{{ url_for('admin_vote_editchoice', voteid=vote.id, choiceid=choice.id) }}" method="post">
  131. <td><input type="text" name="title" value="{{ choice.name }}" /></td>
  132. <td><input type="submit" class="btn btn-small" value="Sauver" />
  133. <a href="{{ url_for('admin_vote_deletechoice', voteid=vote.id, choiceid=choice.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
  134. </form>
  135. </tr>
  136. {% endfor %}
  137. </tbody>
  138. <tfoot>
  139. <tr>
  140. <form action="{{ url_for('admin_vote_addchoice', voteid=vote.id) }}" method="post">
  141. <td><input type="text" name="title" value="Nouveau choix" /></td>
  142. <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
  143. </form>
  144. </tr>
  145. </tfoot>
  146. </table>
  147. </fieldset>
  148. </div>
  149. {% endif %}
  150. <div class="span5 well pull-right">
  151. <fieldset><legend>Pièces jointes</legend>
  152. <table class="table table-stripped table-condensed">
  153. <thead>
  154. <tr>
  155. <th>Lien
  156. <th>Actions
  157. </tr>
  158. </thead>
  159. <tbody>
  160. {% for attachment in attachments %}
  161. <tr>
  162. <td>{{ attachment.url }}</td>
  163. <td><a href="{{ url_for('admin_vote_deleteattachment', voteid=vote.id, attachmentid=attachment.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
  164. </tr>
  165. {% endfor %}
  166. </tbody>
  167. <tfoot>
  168. <tr>
  169. <form action="{{ url_for('admin_vote_addattachment', voteid=vote.id) }}" method="post">
  170. <td><input type="text" name="url" value="Nouveau document" /></td>
  171. <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
  172. </form>
  173. </tr>
  174. </tfoot>
  175. </table>
  176. </fieldset>
  177. </div>
  178. </div>
  179. {% endblock %}