5a467f343b75e0afc74b6b8e2f69e0f12d163a05
[cavote.git] / templates / admin_vote_edit.html
1 {% extends "layout.html" %}
2 {% block body %}
3
4 <div class="row">
5 <div class="span6 well">
6 <form action="{{ url_for('admin_vote_edit', voteid=vote.id) }}" method="post" class="form-horizontal">
7 <fieldset><legend>Édition du vote</legend>
8 <div class="control-group">
9 <label class="control-label" for="title">Titre</label>
10 <div class="controls">
11 <input type="text" size=30 name="title" id="title" value="{{ vote.title }}" />
12 <span class="help-inline"><font color="red">*</font></span>
13 </div>
14 </div>
15 <div class="control-group">
16 <label class="control-label" for="description">Description</label>
17 <div class="controls">
18 <textarea class="input-xlarge" name="description" id="description">{{ vote.description }}</textarea>
19 </div>
20 </div>
21 <div class="accordion">
22 <div class="accordion-group">
23 <div class="accordion-heading">
24 <a class="accordion-toggle" data-toggle="collapse" href="#infos">+ Informations</a>
25 </div>
26 <div id="infos" class="accordion-body collapse">
27 <div class="accordion-inner">
28 <div class="control-group">
29 <label class="control-label" for="category">Catégorie</label>
30 <div class="controls">
31 <input type="text" data-provide="typeahead" data-source='["ca","membres"]' size=30 name="category" id="category" value="{{ vote.category }}" />
32 </div>
33 </div>
34 <div class="control-group">
35 <label class="control-label" for="category">Quorum</label>
36 <div class="controls">
37 <select name="quorum" id="quorum">
38 {% for quorum in quorums %}
39 {% if quorum == vote.quorum %}
40 <option value="{{ quorum }}" selected>{{ quorum * 100 }}%</option>
41 {% else %}
42 <option value="{{ quorum }}">{{ quorum * 100 }}%</option>
43 {% endif %}
44 {% endfor %}
45 </select>
46 </div>
47 </div>
48 <div class="control-group">
49 <label class="control-label" for="role">Groupe</label>
50 <div class="controls">
51 <select name="role" id="role" disabled>
52 <option>{{ group.name }}</option>
53 </select>
54 <p class="help-block">Groupe d'utilisateur concernés par le vote et ayant le droit de voter</p>
55 </div>
56 </div>
57 <div class="control-group">
58 <label class="control-label" for="days">Durée (jours)</label>
59 <div class="controls">
60 <select class="span1" name="days" id="days">
61 {% for i in range(1, 31) %}
62 {% if i == vote.duration %}
63 <option selected>{{ i }}</option>
64 {% else %}
65 <option>{{ i }}</option>
66 {% endif %}
67 {% endfor %}
68 </select>
69 <span class="help-inline">Du {{ vote.date_begin }} au {{ vote.date_end }}</span>
70 </div>
71 </div>
72 <div class="control-group">
73 <label class="control-label" for="reminder">Rappel par mail les</label>
74 <div class="controls">
75 <select class="span1" name="reminder" id="reminder">
76 {% for i in range(1, 31) %}
77 {% if i == vote.reminder_last_days %}
78 <option selected>{{ i }}</option>
79 {% else %}
80 <option>{{ i }}</option>
81 {% endif %}
82 {% endfor %}
83 </select>
84 <span class="help-inline">derniers jours</span>
85 </div>
86 </div>
87 </div>
88 </div>
89 </div>
90 <div class="accordion-group">
91 <div class="accordion-heading">
92 <a class="accordion-toggle" data-toggle="collapse" href="#options">+ Options</a>
93 </div>
94 <div id="options" class="accordion-body collapse">
95 <div class="accordion-inner">
96 <div class="control-group">
97 <label class="control-label">Options</label>
98 <div class="controls">
99 <label class="checkbox">
100 <input type="checkbox" name="transparent" {% if vote.is_transparent == 1 %} checked {% endif %} />
101 Les votants peuvent-ils voir le choix des autres ?
102 </label>
103 <label class="checkbox">
104 <input type="checkbox" name="public" {% if vote.is_public == 1 %} checked {% endif %}/>
105 Le vote est-il visible par tous ?
106 </label>
107 {% if not vote.is_terminated == 1 %}
108 <label class="checkbox">
109 <input type="checkbox" name="anonymous" {% if vote.is_anonymous == 1 %} checked {% endif %} disabled/>
110 Les votes sont-ils anonymes ?
111 </label>
112 {% endif %}
113 </div>
114 </div>
115 <div class="control-group">
116 <label class="control-label" for="value">Valeurs</label>
117 <div class="controls">
118 <select name="value" id="value" disabled>
119 <option>{{ values_ }}</option>
120 </select>
121 </div>
122 </div>
123 </div>
124 </div>
125 </div>
126 </div>
127 <div class="control-group">
128 <label class="control-label" for="status">Statut</label>
129 <div class="controls">
130 <select class="span2" name="status" id="status">
131 {% if vote.is_terminated == 1 %}
132 <option>Fermé</option>
133 <option>Ouvert</option>
134 <option selected>Terminé</option>
135 {% else %}
136 {% if vote.is_open == 1 %}
137 <option>Fermé</option>
138 <option selected>Ouvert</option>
139 <option>Terminé</option>
140 {% else %}
141 <option selected>Fermé</option>
142 <option>Ouvert</option>
143 <option>Terminé</option>
144 {% endif %}
145 {% endif %}
146 </select>
147 </div>
148 </div>
149 <div class="form-actions">
150 <input type="submit" class="btn btn-primary" value="Enregistrer" />
151 <input type="reset" class="btn" value="Annuler" />
152 </div>
153 </fieldset>
154 </form>
155 </div>
156
157 {% if not vote.is_terminated == 1%}
158 <div class="span5 well pull-right">
159 <fieldset><legend>Choix</legend>
160 <table class="table table-stripped table-condensed">
161 <thead>
162 <tr>
163 <th>Titre
164 <th>Actions
165 </tr>
166 </thead>
167 <tbody>
168 {% for choice in choices %}
169 <tr>
170 <form action="{{ url_for('admin_vote_editchoice', voteid=vote.id, choiceid=choice.id) }}" method="post">
171 <td><input type="text" name="title" value="{{ choice.name }}" /></td>
172 <td><input type="submit" class="btn btn-small" value="Sauver" />
173 <a href="#delete{{ choice.id }}" data-toggle="modal" class="btn btn-danger btn-small">Supprimer</a></td>
174 </form>
175 </tr>
176 <div class="modal hide fade" id="delete{{ choice.id }}">
177 <div class="modal-header">
178 <button type="button" class="close" data-dismiss="modal">×</button>
179 <h3>Suppression d'un choix</h3>
180 </div>
181 <div class="modal-body">
182 <p>Voulez-vous vraiment supprimer le choix « {{ choice.name }} » ?</p>
183 </div>
184 <div class="modal-footer">
185 <a href="{{ url_for('admin_vote_deletechoice', voteid=vote.id, choiceid=choice.id) }}" class="btn btn-danger">Confirmer</a>
186 <a href="#" class="btn" data-dismiss="modal">Annuler</a>
187 </div>
188 </div>
189 {% endfor %}
190 </tbody>
191 <tfoot>
192 <tr>
193 <form action="{{ url_for('admin_vote_addchoice', voteid=vote.id) }}" method="post">
194 <td><input type="text" name="title" value="Nouveau choix"
195 onfocus="if(this.value=='Nouveau choix')this.value='';"
196 onblur="if(this.value=='')this.value='Nouveau choix';" /></td>
197 <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
198 </form>
199 </tr>
200 </tfoot>
201 </table>
202 </fieldset>
203 </div>
204 {% endif %}
205
206 <div class="span5 well pull-right">
207 <fieldset><legend>Pièces jointes</legend>
208 <table class="table table-stripped table-condensed">
209 <thead>
210 <tr>
211 <th>Lien
212 <th>Actions
213 </tr>
214 </thead>
215 <tbody>
216 {% for attachment in attachments %}
217 <tr>
218 <td>{{ attachment.url }}</td>
219 <td><a href="{{ url_for('admin_vote_deleteattachment', voteid=vote.id, attachmentid=attachment.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
220 </tr>
221 {% endfor %}
222 </tbody>
223 <tfoot>
224 <tr>
225 <form action="{{ url_for('admin_vote_addattachment', voteid=vote.id) }}" method="post">
226 <td><input type="text" name="url" value="Nouveau document"
227 onfocus="if(this.value=='Nouveau document')this.value='';"
228 onblur="if(this.value=='')this.value='Nouveau document';" /></td>
229 <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
230 </form>
231 </tr>
232 </tfoot>
233 </table>
234 </fieldset>
235 </div>
236
237 </div>
238
239 {% endblock %}