Reformat templates to fit with the rest of the Sith

This commit is contained in:
Skia 2016-12-26 00:10:41 +01:00
parent 61e67898e1
commit bf4d0693c6
3 changed files with 36 additions and 28 deletions

View File

@ -7,12 +7,13 @@
{% block content %} {% block content %}
{%- if election.can_candidate(user) or user.can_edit(election) %} {%- if election.can_candidate(user) or user.can_edit(election) %}
<section class="election__add-candidature"> <section class="election__add-candidature">
<form action="{{url('election:candidate', election_id=election.id)}}" method="post">{{form.as_p()}} <form action="{{ url('election:candidate', election_id=election.id) }}" method="post">
<p><input type="submit" value="{% trans %}Candidate{% endtrans %}" /></p> {% csrf_token %}
{% csrf_token %} {{ form.as_p() }}
<p><input type="submit" value="{% trans %}Candidate{% endtrans %}" /></p>
</form> </form>
</section> </section>
{%- else -%} {%- else -%}
{% trans %}Candidature are closed for this election{% endtrans %} {% trans %}Candidature are closed for this election{% endtrans %}
{%- endif %} {%- endif %}
{% endblock content %} {% endblock content %}

View File

@ -1,7 +1,7 @@
{% extends "core/base.jinja" %} {% extends "core/base.jinja" %}
{% block title %} {% block title %}
{{object.title}} {{ object.title }}
{% endblock %} {% endblock %}
{% block head %} {% block head %}
@ -239,10 +239,12 @@ th {
{% trans %}Polls closed {% endtrans %} {% trans %}Polls closed {% endtrans %}
{%- else %} {%- else %}
{% trans %}Polls will open {% endtrans %} {% trans %}Polls will open {% endtrans %}
<time datetime="{{ election.start_date }}">{{ election.start_date|localtime|date("l d F Y")}}</time>{% trans %} at {% endtrans %}<time>{{ election.start_date|localtime|time("G:i")}}</time> <time datetime="{{ election.start_date }}">{{ election.start_date|localtime|date(DATETIME_FORMAT)}}</time>
{% trans %} at {% endtrans %}<time>{{ election.start_date|localtime|time(DATETIME_FORMAT)}}</time>
{% trans %}and will close {% endtrans %} {% trans %}and will close {% endtrans %}
{%- endif %} {%- endif %}
<time datetime="{{ election.end_date }}">{{ election.end_date|localtime|date("l d F Y")}}</time>{% trans %} at {% endtrans %}<time>{{ election.end_date|localtime|time("G:i")}}</time> <time datetime="{{ election.end_date }}">{{ election.end_date|localtime|date(DATETIME_FORMAT)}}</time>
{% trans %} at {% endtrans %}<time>{{ election.end_date|localtime|time(DATETIME_FORMAT)}}</time>
</p> </p>
{%- if election.has_voted(user) %} {%- if election.has_voted(user) %}
<p class="election__elector-infos"> <p class="election__elector-infos">
@ -255,7 +257,7 @@ th {
{%- endif %} {%- endif %}
</section> </section>
<section class="election__vote"> <section class="election__vote">
<form action="{{url('election:vote', election.id)}}" method="post" class="election__vote-form" name="vote-form" id="vote-form"> <form action="{{ url('election:vote', election.id) }}" method="post" class="election__vote-form" name="vote-form" id="vote-form">
{% csrf_token %} {% csrf_token %}
<table> <table>
{%- set election_lists = election.election_lists.all() -%} {%- set election_lists = election.election_lists.all() -%}
@ -263,7 +265,7 @@ th {
<thead> <thead>
<th>{% trans %}Blank vote{% endtrans %}</th> <th>{% trans %}Blank vote{% endtrans %}</th>
{%- for election_list in election_lists %} {%- for election_list in election_lists %}
<th>{{election_list.title}}</th> <th>{{ election_list.title }}</th>
{%- endfor %} {%- endfor %}
</thead> </thead>
{%- for role in election.roles.all() %} {%- for role in election.roles.all() %}
@ -271,8 +273,8 @@ th {
{%- set role_data = election_form.data.getlist(role.title) if role.title in election_form.data else [] %} {%- set role_data = election_form.data.getlist(role.title) if role.title in election_form.data else [] %}
<tbody data-max-choice="{{role.max_choice}}" class="role{{ ' role_error' if role.title in election_form.errors else '' }}{{ ' role__multiple-choices' if role.max_choice > 1 else ''}}"> <tbody data-max-choice="{{role.max_choice}}" class="role{{ ' role_error' if role.title in election_form.errors else '' }}{{ ' role__multiple-choices' if role.max_choice > 1 else ''}}">
<tr class="role__title"> <tr class="role__title">
<td colspan="{{election_lists.count() + 1}}"> <td colspan="{{ election_lists.count() + 1 }}">
<span>{{role.title}}</span> <span>{{ role.title }}</span>
{% if user.can_edit(role) and election.is_vote_editable -%} {% if user.can_edit(role) and election.is_vote_editable -%}
<a href="{{url('election:update_role', role_id=role.id)}}">{% trans %}Edit{% endtrans %}</a> <a href="{{url('election:update_role', role_id=role.id)}}">{% trans %}Edit{% endtrans %}</a>
<a href="{{url('election:delete_role', role_id=role.id)}}">{% trans %}Delete{% endtrans %}</a> <a href="{{url('election:delete_role', role_id=role.id)}}">{% trans %}Delete{% endtrans %}</a>
@ -299,7 +301,7 @@ th {
{%- if election.is_vote_finished %} {%- if election.is_vote_finished %}
{%- set results = election_results[role.title]['blank vote'] %} {%- set results = election_results[role.title]['blank vote'] %}
<div class="election__results"> <div class="election__results">
<strong>{{results.vote}} {% trans %}votes{% endtrans %} ({{results.percent}} %)</strong> <strong>{{ results.vote }} {% trans %}votes{% endtrans %} ({{ results.percent }} %)</strong>
</div> </div>
{%- endif %} {%- endif %}
</td> </td>
@ -311,7 +313,7 @@ th {
<figure class="candidate__infos"> <figure class="candidate__infos">
<div class="candidate__picture-wrapper"> <div class="candidate__picture-wrapper">
{%- if candidature.user.profile_pict and user.is_subscriber_viewable %} {%- if candidature.user.profile_pict and user.is_subscriber_viewable %}
<img class="candidate__picture" src="{{candidature.user.profile_pict.get_download_url()}}" alt="{% trans %}Profile{% endtrans %}"> <img class="candidate__picture" src="{{ candidature.user.profile_pict.get_download_url() }}" alt="{% trans %}Profile{% endtrans %}">
{%- endif %} {%- endif %}
</div> </div>
<figcaption class="candidate__details"> <figcaption class="candidate__details">
@ -337,7 +339,7 @@ th {
{%- if election.is_vote_finished %} {%- if election.is_vote_finished %}
{%- set results = election_results[role.title][candidature.user.username] %} {%- set results = election_results[role.title][candidature.user.username] %}
<div class="election__results"> <div class="election__results">
<strong>{{results.vote}} {% trans %}votes{% endtrans %} ({{results.percent}} %)</strong> <strong>{{ results.vote }} {% trans %}votes{% endtrans %} ({{ results.percent }} %)</strong>
</div> </div>
{%- endif %} {%- endif %}
</li> </li>
@ -358,14 +360,14 @@ th {
{%- endif %} {%- endif %}
<section class="election__add-elements"> <section class="election__add-elements">
{%- if election.can_candidate(user) or user.can_edit(election) %} {%- if election.can_candidate(user) or user.can_edit(election) %}
<a href="{{url('election:candidate', election_id=object.id)}}">{% trans %}Candidate{% endtrans %}</a> <a href="{{ url('election:candidate', election_id=object.id) }}">{% trans %}Candidate{% endtrans %}</a>
{%- endif %} {%- endif %}
<a href="{{url('election:create_list', election_id=object.id)}}">{% trans %}Add a new list{% endtrans %}</a> <a href="{{ url('election:create_list', election_id=object.id) }}">{% trans %}Add a new list{% endtrans %}</a>
{%- if user.can_edit(election) %} {%- if user.can_edit(election) %}
{% if election.is_vote_editable %} {% if election.is_vote_editable %}
<a href="{{url('election:create_role', election_id=object.id)}}">{% trans %}Add a new role{% endtrans %}</a> <a href="{{ url('election:create_role', election_id=object.id) }}">{% trans %}Add a new role{% endtrans %}</a>
{% endif %} {% endif %}
<a href="{{url('election:update', election_id=object.id)}}">{% trans %}Edit{% endtrans %}</a> <a href="{{ url('election:update', election_id=object.id) }}">{% trans %}Edit{% endtrans %}</a>
{%- endif %} {%- endif %}
</section> </section>
{% endblock %} {% endblock %}
@ -395,4 +397,4 @@ function setupRestrictions(role) {
} }
} }
</script> </script>
{% endblock %} {% endblock %}

View File

@ -26,18 +26,23 @@
<a href="{{ url('election:detail', election_id=election.id) }}">{{ election }}</a> <a href="{{ url('election:detail', election_id=election.id) }}">{{ election }}</a>
</h4> </h4>
<p> <p>
{% trans %}Applications open from{% endtrans %} {% trans %}Applications open from{% endtrans %}
<time datetime="{{ election.start_candidature }}">{{ election.start_candidature|localtime|date("l d F Y") }}</time>{% trans %} at {% endtrans %}<time>{{ election.start_candidature|localtime|time("G:i") }}</time> <time datetime="{{ election.start_candidature }}">{{ election.start_candidature|localtime|date(DATETIME_FORMAT) }}</time>
{% trans %}to{% endtrans %} {% trans %} at {% endtrans %}<time>{{ election.start_candidature|localtime|time(DATETIME_FORMAT) }}</time>
<time datetime="{{ election.end_candidature }}">{{ election.end_candidature|localtime|date("l d F Y") }}</time>{% trans %} at {% endtrans %}<time>{{ election.end_candidature|time("G:i") }}</time> {% trans %}to{% endtrans %}
<time datetime="{{ election.end_candidature }}">{{ election.end_candidature|localtime|date(DATETIME_FORMAT) }}</time>
{% trans %} at {% endtrans %}<time>{{ election.end_candidature|time(DATETIME_FORMAT) }}</time>
</p> </p>
<p> <p>
{% trans %}Polls open from{% endtrans %} {% trans %}Polls open from{% endtrans %}
<time datetime="{{ election.start_date }}">{{ election.start_date|localtime|date("l d F Y") }}</time>{% trans %} at {% endtrans %}<time>{{ election.start_date|localtime|time("G:i") }}</time> <time datetime="{{ election.start_date }}">{{ election.start_date|localtime|date(DATETIME_FORMAT) }}</time>
{% trans %}to{% endtrans %} {% trans %} at {% endtrans %}<time>{{ election.start_date|localtime|time(DATETIME_FORMAT) }}</time>
<time datetime="{{ election.end_date }}">{{ election.end_date|localtime|date("l d F Y") }}</time>{% trans %} at {% endtrans %}<time>{{ election.end_date|localtime|time("G:i") }}</time> {% trans %}to{% endtrans %}
<time datetime="{{ election.end_date }}">{{ election.end_date|localtime|date(DATETIME_FORMAT) }}</time>
{% trans %} at {% endtrans %}<time>{{ election.end_date|localtime|time(DATETIME_FORMAT) }}</time>
</p> </p>
<p>{{ election.description }}</p> <p>{{ election.description }}</p>
</section> </section>
{%- endfor %} {%- endfor %}
{%- endblock %} {%- endblock %}