123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- {% extends "layout.html" %}
- {% block subtitle %}{{vote.title}}{% endblock %}
- {% block body %}
- <div class="row">
- <div class="span3">
- <h2 class="page-header">Informations</h2>
- <div class="progress progress-striped progress-{% if vote.nb_votes > 0 and vote.nb_votes / vote.max_votes >= vote.quorum %}success{% else %}danger{% endif %}">
- <div class="bar" style="width: {{ vote.percent }}%;">
- <strong>{{ vote.nb_votes }} vote{{ 's' if vote.nb_votes > 1 else '' }} / {{ vote.max_votes }} ({{ vote.percent }}%)</strong></div>
- </div>
- <dl class="dl-horizontal">
- <dt>Publié par <dd><code>{{ vote.author }}</code>
- <dt>Début le <dd><code>{{ vote.date_begin }}</code>
- <dt>Fin le <dd><code>{{ vote.date_end }}</code>
- <dt>Groupe <dd><code>{{ vote.groupname }}</code>
- <dt>Catégorie <dd><code>{{ vote.category }}</code>
- <dt>Quorum <dd><code>{{ vote.quorum * 100 }}%</code>
- </dl>
- <dl>
- {% if vote.description %}
- <dt>Description : <dd>{{ vote.description }}
- {% endif %}
- {% if attachments %}
- <dt>Documents :<dd>
- <ul>
- {% for attachment in attachments %}
- <li><a href="{{ attachment.url }}">{{ attachment.url }}</a></li>
- {% endfor %}
- </ul>
- {% endif %}
- </dl>
- </div>
- {% if vote.is_transparent or (session.user and user.userid == session.user.id )%}
- <div class="span8">
- <h2 class='page-header'>Résultats</h2>
- <svg class="results cardinal-{{ vote.id_cardinal }}"
- width="{{ 150 + (100 * 5) + 100 + 100 }}"
- height="{{25 + results.list|length * 20 + 40}}">
- <g class="choice" transform="translate(100,0)">
- <text class="choice-legend" x="-10" y="9.5" dy=".35em">Légende :</text>
- {% for value in values %}
- <g transform="translate({{ (loop.index0 * 750 / loop.length) }},0)">
- <rect width="{{ 750 / loop.length + 1 }}" height="18"></rect>
- <rect class="{{ value.class }}" x="1" y ="0" width="{{ 750 / loop.length - 1}}" height="18"></rect>
- <text class="choice-legend-item" text-anchor="start" x="{{ 750 / loop.length - 2 }}" y="9.5" dy=".35em"
- >{{ value.name }}</text>
- </g>
- {% endfor %}
- </g>
- <g transform="translate({{150 + (100 * 5) + 35}},20)">
- <text class="choice-sum-legend" x="20" y="9.5" dy=".35em">somme↓</text>
- </g>
- <g transform="translate({{150 + (100 * 5) + 115}},20)">
- <text class="choice-average-legend" x="20" y="9.5" dy=".35em">moyenne↓</text>
- </g>
- {% for choice in results.list %}
- <g class="choice" transform="translate(150,{{ 35 + loop.index0 * 20 }})">
- <text class="choice" x="-10" y="9.5" dy=".35em">{{ choice.name }}</text>
- </g>
- {% set choice_loop = loop %}
- {% for value in choice.values_ %}
- <g transform="translate({{ 150 + (value.previous_percent * 5) }},{{ 35 + choice_loop.index0 * 20 }})">
- {% if value.percent > 0 %}
- <rect class="{{ value.class }}" width="{{ (value.percent * 5)|int }}" height="19"></rect>
- <text text-anchor="middle" x="{{ (value.percent * 5 / 2 + 10)|int }}" y="9.5" dy=".35em"
- >{{ value.percent|int }}%</text>
- {% endif %}
- </g>
- {% endfor %}
- <g transform="translate({{150 + (100 * 5) + 35}},{{35 + loop.index0 * 20}})">
- <text class="choice-sum" x="20" y="9.5" dy=".35em">{{ choice.sum }}</text>
- </g>
- <g transform="translate({{150 + (100 * 5) + 115}},{{35 + loop.index0 * 20}})">
- <text class="choice-average" x="20" y="9.5" dy=".35em">{{ "%.2f"|format(choice.average) }}</text>
- </g>
- {% if loop.length > 1 and choice.id in results.medians %}
- <g transform="translate({{150 + (100 * 5) + 125}},{{35 + loop.index0 * 20}})">
- <text class="choice-median" x="75" y="9.5" dy=".35em">← médiane</text>
- </g>
- {%endif%}
- {% endfor %}
- <g class="axis" transform="translate(150,{{35 + results.list|length * 20}})">
- <g transform="translate(0,0)" style="opacity: 1;" class="tick">
- <line x1="0" y1="6" x2="0" y2="0"></line>
- <text style="text-anchor: middle;" dy=".71em" x="0" y="9">0%</text>
- </g>
- <g transform="translate(125,0)" style="opacity: 1;" class="tick">
- <line x1="0" y1="6" x2="0" y2="0"></line>
- <text style="text-anchor: middle;" dy=".71em" x="0" y="9">25%</text>
- </g>
- <g transform="translate(250,0)" style="opacity: 1;" class="tick">
- <line x1="0" y1="6" x2="0" y2="0"></line>
- <text style="text-anchor: middle;" dy=".71em" x="0" y="9">50%</text>
- </g>
- <g transform="translate(375,0)" style="opacity: 1;" class="tick">
- <line x1="0" y1="6" x2="0" y2="0"></line>
- <text style="text-anchor: middle;" dy=".71em" x="0" y="9">75%</text>
- </g>
- <g transform="translate(500,0)" style="opacity: 1;" class="tick">
- <line x1="0" y1="6" x2="0" y2="0"></line>
- <text style="text-anchor: middle;" dy=".71em" x="0" y="9">100%</text>
- </g>
- <path d="M0,6V0H500V6" class="domain"></path>
- </g>
- </svg>
- </div>
- {% endif %}
- <div class="span9">
- <h2 class='page-header'>Suffrages</h2>
- {% if vote.is_anonymous %}
- <div class="alert alert-info">Ce vote est anonymisé, les suffrages ne sont ni visibles ni modifiables.</div>
- {% endif %}
- {% if not vote.is_transparent %}
- <div class="alert alert-info">Ce vote n’est pas transparent, vous ne pouvez pas voir les votes des autres.</div>
- {% endif %}
- {% if (vote['is_anonymous'] and can_vote) or not vote['is_anonymous'] %}
- <table class="table table-condensed table-bordered table-votes cardinal-{{ vote.id_cardinal }}">
- <thead>
- <tr>
- <th class="users">Votant-e-s</th>
- {% for choice in choices %}
- <th class="choice-name">{{ choice.name }}</th>
- {% endfor %}
- {% if 'user' in session and (can_vote or (not vote['is_terminated'] and not vote['is_anonymous'])) %}
- <th></th>
- {% else %}
- <th class="comments">Commentaires</th>
- {% endif %}
- </tr>
- {% if vote.is_transparent %}
- <!--
- <tr>
- <th>Somme</th>
- {% for choice in choices %}
- <td>{{ choice.sum }}</td>
- {% endfor %}
- {% if 'user' in session and (can_vote or (not vote['is_terminated'] and not vote['is_anonymous'])) %}
- <td></td>
- {% endif %}
- </tr>
- -->
- {% endif %}
- {% if can_vote %}
- <form class="form-inline" action="{{ url_for('vote', idvote=vote.id) }}" method="post">
- <tr>
- <th><input type='text' name="username" value='{{ session.user.name }}' disabled /></th>
- {% for choice in choices %}
- <td>
- <select name="value-{{ choice.id }}" id="value-{{ choice.id }}">
- {% for value in values %}
- <option value="{% if value.weight is not none %}{{ value.weight }}{% endif %}" class="{{ value.class }}">{{ value.name }}</option>
- {% endfor %}
- </select>
- </td>
- {% endfor %}
- <td><input type="submit" class="btn btn-primary" value="OK" />
- <textarea name="comment" class="input-xlarge" placeholder="Commentaire"></textarea></td>
- </tr>
- </form>
- {% endif %}
- </thead>
- {% if not vote['is_anonymous'] %}
- <tbody>
- {% for user in users %}
- {% if vote.is_transparent or (session.user and user.userid == session.user.id )%}
- <tr>
- <th>{% if 'user' in session and user.userid == session.user.id %}<i class="icon-user"></i>{% endif %} {{ user.username }}</th>
- {% for choice in choices %}
- <td class="{{user.choices[choice.id].class}}"><span>{{ user.choices[choice.id].name }}</span></td>
- {% endfor %}
- {% if 'user' in session and (can_vote or (not vote['is_terminated'] and not vote['is_anonymous'])) %}
- <td class="ok">{% if user.userid == session.user.id %}
- <a href="#delete" data-toggle="modal" class="btn btn-danger btn-mini" title="Supprimer"><i class="icon-remove icon-white"></i></a>
- <div class="modal hide fade" id="delete">
- <div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">×</button>
- <h3>Suppression de votre vote</h3>
- </div>
- <div class="modal-body">
- <p>Voulez-vous vraiment supprimer votre vote ?</p>
- </div>
- <div class="modal-footer">
- <a href="{{ url_for('vote_deletechoices', idvote=vote.id, iduser=session.user.id) }}" class="btn btn-danger">Confirmer</a>
- <a href="#" class="btn" data-dismiss="modal">Annuler</a>
- </div>
- </div>
- {% endif %}
- <span class="comment">{% if user.comment %}{{user.comment}}{%endif%}</span>
- </td>
- {% else %}
- <td class="ok">
- <span class="comment">{% if user.comment %}{{user.comment}}{%endif%}</span>
- </td>
- {% endif %}
- </tr>
- {% endif %}
- {% endfor %}
- </tbody>
- {% endif %}
- </table>
- {% else %}
- {% if not can_vote %}
- <div class="alert alert-info">Vous avez déjà voté.</div>
- {% endif %}
- {% endif %}
- </div>
- {% if vote.is_anonymous %}
- <div class="span9">
- <h2 class='page-header'>Commentaires</h2>
- <table class="table table-condensed table-bordered table-comments">
- <tbody>
- {% for user in users %}
- <tr><td><span class="comment">{% if user.comment %}{{user.comment}}{%endif%}</span></td></tr>
- {% endfor %}
- </tbody>
- </table>
- {% endif %}
- </div>
- {% endblock %}
|