modify to range voting
[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 {% endif %}
144 {% endif %}
145 </select>
146 </div>
147 </div>
148 <div class="form-actions">
149 <input type="submit" class="btn btn-primary" value="Enregistrer" />
150 <input type="reset" class="btn" value="Annuler" />
151 </div>
152 </fieldset>
153 </form>
154 </div>
155
156 {% if not vote.is_terminated == 1%}
157 <div class="span5 well pull-right">
158 <fieldset><legend>Choix</legend>
159 <table class="table table-stripped table-condensed">
160 <thead>
161 <tr>
162 <th>Titre
163 <th>Actions
164 </tr>
165 </thead>
166 <tbody>
167 {% for choice in choices %}
168 <tr>
169 <form action="{{ url_for('admin_vote_editchoice', voteid=vote.id, choiceid=choice.id) }}" method="post">
170 <td><input type="text" name="title" value="{{ choice.name }}" /></td>
171 <td><input type="submit" class="btn btn-small" value="Sauver" />
172 <a href="#delete{{ choice.id }}" data-toggle="modal" class="btn btn-danger btn-small">Supprimer</a></td>
173 </form>
174 </tr>
175 <div class="modal hide fade" id="delete{{ choice.id }}">
176 <div class="modal-header">
177 <button type="button" class="close" data-dismiss="modal">×</button>
178 <h3>Suppression d'un choix</h3>
179 </div>
180 <div class="modal-body">
181 <p>Voulez-vous vraiment supprimer le choix « {{ choice.name }} » ?</p>
182 </div>
183 <div class="modal-footer">
184 <a href="{{ url_for('admin_vote_deletechoice', voteid=vote.id, choiceid=choice.id) }}" class="btn btn-danger">Confirmer</a>
185 <a href="#" class="btn" data-dismiss="modal">Annuler</a>
186 </div>
187 </div>
188 {% endfor %}
189 </tbody>
190 <tfoot>
191 <tr>
192 <form action="{{ url_for('admin_vote_addchoice', voteid=vote.id) }}" method="post">
193 <td><input type="text" name="title" value="Nouveau choix"
194 onfocus="if(this.value=='Nouveau choix')this.value='';"
195 onblur="if(this.value=='')this.value='Nouveau choix';" /></td>
196 <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
197 </form>
198 </tr>
199 </tfoot>
200 </table>
201 </fieldset>
202 </div>
203 {% endif %}
204
205 <div class="span5 well pull-right">
206 <fieldset><legend>Pièces jointes</legend>
207 <table class="table table-stripped table-condensed">
208 <thead>
209 <tr>
210 <th>Lien
211 <th>Actions
212 </tr>
213 </thead>
214 <tbody>
215 {% for attachment in attachments %}
216 <tr>
217 <td>{{ attachment.url }}</td>
218 <td><a href="{{ url_for('admin_vote_deleteattachment', voteid=vote.id, attachmentid=attachment.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
219 </tr>
220 {% endfor %}
221 </tbody>
222 <tfoot>
223 <tr>
224 <form action="{{ url_for('admin_vote_addattachment', voteid=vote.id) }}" method="post">
225 <td><input type="text" name="url" value="Nouveau document"
226 onfocus="if(this.value=='Nouveau document')this.value='';"
227 onblur="if(this.value=='')this.value='Nouveau document';" /></td>
228 <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
229 </form>
230 </tr>
231 </tfoot>
232 </table>
233 </fieldset>
234 </div>
235
236 </div>
237
238 {% endblock %}