modify to range voting
[cavote.git] / templates / admin_vote_edit.html
index 841e15b..1b0c3eb 100644 (file)
@@ -3,7 +3,7 @@
 
 <div class="row">
   <div class="span6 well">
-    <form action="{{ url_for('admin_vote_edit', voteid=vote['id']) }}" method="post" class="form-horizontal">
+    <form action="{{ url_for('admin_vote_edit', voteid=vote.id) }}" method="post" class="form-horizontal">
       <fieldset><legend>Édition du vote</legend>
       <div class="control-group">
         <label class="control-label" for="title">Titre</label>
                   <input type="text" data-provide="typeahead" data-source='["ca","membres"]' size=30 name="category" id="category" value="{{ vote.category }}" />
                 </div>
               </div>
+              <div class="control-group">
+                <label class="control-label" for="category">Quorum</label>
+                <div class="controls">
+                  <select name="quorum" id="quorum">
+                    {% for quorum in quorums %}
+                    {% if quorum == vote.quorum %}
+                    <option value="{{ quorum }}" selected>{{ quorum * 100 }}%</option>
+                    {% else %}
+                    <option value="{{ quorum }}">{{ quorum * 100 }}%</option>
+                    {% endif %}
+                    {% endfor %}
+                  </select>
+                </div>
+              </div>
               <div class="control-group">
                 <label class="control-label" for="role">Groupe</label>
                 <div class="controls">
                   <span class="help-inline">Du {{ vote.date_begin }} au {{ vote.date_end }}</span>
                 </div>
               </div>
+              <div class="control-group">
+                <label class="control-label" for="reminder">Rappel par mail les</label>
+                <div class="controls">
+                  <select class="span1" name="reminder" id="reminder">
+                    {% for i in range(1, 31) %}
+                    {% if i == vote.reminder_last_days %}
+                    <option selected>{{ i }}</option>
+                    {% else %}
+                    <option>{{ i }}</option>
+                    {% endif %}
+                    {% endfor %}
+                  </select>
+                  <span class="help-inline">derniers jours</span>
+                </div>
+              </div>
             </div>
           </div>
         </div>
                     <input type="checkbox" name="public" {% if vote.is_public == 1 %} checked {% endif %}/>
                     Le vote est-il visible par tous ?
                   </label>
+                {% if not vote.is_terminated == 1 %}
                   <label class="checkbox">
-                    <input type="checkbox" name="multiplechoice" {% if vote.is_multiplechoice == 1 %} checked {% endif %} disabled/>
-                    Les votants peuvent-ils choisir plusieurs options ?
+                    <input type="checkbox" name="anonymous" {% if vote.is_anonymous == 1 %} checked {% endif %} disabled/>
+                    Les votes sont-ils anonymes ?
                   </label>
+                {% endif %}
+                </div>
+              </div>
+              <div class="control-group">
+                <label class="control-label" for="value">Valeurs</label>
+                <div class="controls">
+                  <select name="value" id="value" disabled>
+                      <option>{{ values_ }}</option>
+                  </select>
                 </div>
               </div>
             </div>
         <label class="control-label" for="status">Statut</label>
         <div class="controls">
           <select class="span2" name="status" id="status">
-            {% if vote.is_open %}
-              <option>Fermé</option>
-              <option selected>Ouvert</option>
+            {% if vote.is_terminated == 1 %}
+                  <option>Fermé</option>
+                  <option>Ouvert</option>
+                  <option selected>Terminé</option>
             {% else %}
-              <option selected>Fermé</option>
-              <option>Ouvert</option>
+                {% if vote.is_open == 1 %}
+                  <option>Fermé</option>
+                  <option selected>Ouvert</option>
+                  <option>Terminé</option>
+                {% else %}
+                  <option selected>Fermé</option>
+                  <option>Ouvert</option>
+                {% endif %}
             {% endif %}
           </select>
         </div>
     </form>
   </div>
 
+  {% if not vote.is_terminated == 1%}
   <div class="span5 well pull-right">
     <fieldset><legend>Choix</legend>
       <table class="table table-stripped table-condensed">
             <form action="{{ url_for('admin_vote_editchoice', voteid=vote.id, choiceid=choice.id) }}" method="post">
               <td><input type="text" name="title" value="{{ choice.name }}" /></td>
               <td><input type="submit" class="btn btn-small" value="Sauver" /> 
-                  <a href="{{ url_for('admin_vote_deletechoice', voteid=vote.id, choiceid=choice.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
+                  <a href="#delete{{ choice.id }}" data-toggle="modal" class="btn btn-danger btn-small">Supprimer</a></td>
             </form>
           </tr>
+          <div class="modal hide fade" id="delete{{ choice.id }}">
+            <div class="modal-header">
+              <button type="button" class="close" data-dismiss="modal">×</button>
+              <h3>Suppression d'un choix</h3>
+            </div>
+            <div class="modal-body">
+              <p>Voulez-vous vraiment supprimer le choix « {{ choice.name }} » ?</p>
+            </div>
+            <div class="modal-footer">
+              <a href="{{ url_for('admin_vote_deletechoice', voteid=vote.id, choiceid=choice.id) }}" class="btn btn-danger">Confirmer</a>
+              <a href="#" class="btn" data-dismiss="modal">Annuler</a>
+            </div>
+          </div>
         {% endfor %}
         </tbody>
         <tfoot>
           <tr>
             <form action="{{ url_for('admin_vote_addchoice', voteid=vote.id) }}" method="post">
-              <td><input type="text" name="title" value="Nouveau choix" /></td>
+              <td><input type="text" name="title" value="Nouveau choix"
+                onfocus="if(this.value=='Nouveau choix')this.value='';"
+                onblur="if(this.value=='')this.value='Nouveau choix';" /></td>
               <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
             </form>
           </tr>
       </table>
     </fieldset>
   </div>
+  {% endif %}
+
+  <div class="span5 well pull-right">
+    <fieldset><legend>Pièces jointes</legend>
+      <table class="table table-stripped table-condensed">
+        <thead>
+          <tr>
+            <th>Lien
+            <th>Actions
+          </tr>
+        </thead>
+        <tbody>
+        {% for attachment in attachments %}
+          <tr>
+            <td>{{ attachment.url }}</td>
+            <td><a href="{{ url_for('admin_vote_deleteattachment', voteid=vote.id, attachmentid=attachment.id) }}" class="btn btn-small btn-danger">Supprimer</a></td>
+          </tr>
+        {% endfor %}
+        </tbody>
+        <tfoot>
+          <tr>
+            <form action="{{ url_for('admin_vote_addattachment', voteid=vote.id) }}" method="post">
+              <td><input type="text" name="url" value="Nouveau document" 
+                onfocus="if(this.value=='Nouveau document')this.value='';"
+                onblur="if(this.value=='')this.value='Nouveau document';" /></td>
+              <td><input type="submit" class="btn btn-small btn-primary" value="+ Ajouter" />
+            </form>
+          </tr>
+        </tfoot>
+      </table>
+    </fieldset>
+  </div>
+
 </div>
 
 {% endblock %}