Interface details
[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="role">Groupe</label>
36 <div class="controls">
37 <select name="role" id="role" disabled>
38 <option>{{ group.name }}</option>
39 </select>
40 <p class="help-block">Groupe d'utilisateur concernés par le vote et ayant le droit de voter</p>
41 </div>
42 </div>
43 <div class="control-group">
44 <label class="control-label" for="days">Durée (jours)</label>
45 <div class="controls">
46 <select class="span1" name="days" id="days">
47 {% for i in range(1, 31) %}
48 {% if i == vote.duration %}
49 <option selected>{{ i }}</option>
50 {% else %}
51 <option>{{ i }}</option>
52 {% endif %}
53 {% endfor %}
54 </select>
55 <span class="help-inline">Du {{ vote.date_begin }} au {{ vote.date_end }}</span>
56 </div>
57 </div>
58 </div>
59 </div>
60 </div>
61 <div class="accordion-group">
62 <div class="accordion-heading">
63 <a class="accordion-toggle" data-toggle="collapse" href="#options">+ Options</a>
64 </div>
65 <div id="options" class="accordion-body collapse">
66 <div class="accordion-inner">
67 <div class="control-group">
68 <label class="control-label">Options</label>
69 <div class="controls">
70 <label class="checkbox">
71 <input type="checkbox" name="transparent" {% if vote.is_transparent == 1 %} checked {% endif %} />
72 Les votants peuvent-ils voir le choix des autres ?
73 </label>
74 <label class="checkbox">
75 <input type="checkbox" name="public" {% if vote.is_public == 1 %} checked {% endif %}/>
76 Le vote est-il visible par tous ?
77 </label>
78 {% if not vote.is_terminated == 1 %}
79 <label class="checkbox">
80 <input type="checkbox" name="multiplechoice" {% if vote.is_multiplechoice == 1 %} checked {% endif %} disabled/>
81 Les votants peuvent-ils choisir plusieurs options ?
82 </label>
83 {% endif %}
84 </div>
85 </div>
86 </div>
87 </div>
88 </div>
89 </div>
90 <div class="control-group">
91 <label class="control-label" for="status">Statut</label>
92 <div class="controls">
93 <select class="span2" name="status" id="status">
94 {% if vote.is_terminated == 1 %}
95 <option>Fermé</option>
96 <option>Ouvert</option>
97 <option selected>Terminé</option>
98 {% else %}
99 {% if vote.is_open == 1 %}
100 <option>Fermé</option>
101 <option selected>Ouvert</option>
102 <option>Terminé</option>
103 {% else %}
104 <option selected>Fermé</option>
105 <option>Ouvert</option>
106 {% endif %}
107 {% endif %}
108 </select>
109 </div>
110 </div>
111 <div class="form-actions">
112 <input type="submit" class="btn btn-primary" value="Enregistrer" />
113 <input type="reset" class="btn" value="Annuler" />
114 </div>
115 </fieldset>
116 </form>
117 </div>
118
119 {% if not vote.is_terminated == 1%}
120 <div class="span5 well pull-right">
121 <fieldset><legend>Choix</legend>
122 <table class="table table-stripped table-condensed">
123 <thead>
124 <tr>
125 <th>Titre
126 <th>Actions
127 </tr>
128 </thead>
129 <tbody>
130 {% for choice in choices %}
131 <tr>
132 <form action="{{ url_for('admin_vote_editchoice', voteid=vote.id, choiceid=choice.id) }}" method="post">
133 <td><input type="text" name="title" value="{{ choice.name }}" /></td>
134 <td><input type="submit" class="btn btn-small" value="Sauver" />
135 <a href="{{ url_for('admin_vote_deletechoice', voteid=vote.id, choiceid=choice.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
136 </form>
137 </tr>
138 {% endfor %}
139 </tbody>
140 <tfoot>
141 <tr>
142 <form action="{{ url_for('admin_vote_addchoice', voteid=vote.id) }}" method="post">
143 <td><input type="text" name="title" value="Nouveau choix"
144 onfocus="if(this.value=='Nouveau choix')this.value='';"
145 onblur="if(this.value=='')this.value='Nouveau choix';" /></td>
146 <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
147 </form>
148 </tr>
149 </tfoot>
150 </table>
151 </fieldset>
152 </div>
153 {% endif %}
154
155 <div class="span5 well pull-right">
156 <fieldset><legend>Pièces jointes</legend>
157 <table class="table table-stripped table-condensed">
158 <thead>
159 <tr>
160 <th>Lien
161 <th>Actions
162 </tr>
163 </thead>
164 <tbody>
165 {% for attachment in attachments %}
166 <tr>
167 <td>{{ attachment.url }}</td>
168 <td><a href="{{ url_for('admin_vote_deleteattachment', voteid=vote.id, attachmentid=attachment.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
169 </tr>
170 {% endfor %}
171 </tbody>
172 <tfoot>
173 <tr>
174 <form action="{{ url_for('admin_vote_addattachment', voteid=vote.id) }}" method="post">
175 <td><input type="text" name="url" value="Nouveau document"
176 onfocus="if(this.value=='Nouveau document')this.value='';"
177 onblur="if(this.value=='')this.value='Nouveau document';" /></td>
178 <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
179 </form>
180 </tr>
181 </tfoot>
182 </table>
183 </fieldset>
184 </div>
185
186 </div>
187
188 {% endblock %}