Hide input if user can not vote

This commit is contained in:
Jean-Baptiste Lenglet 2016-12-23 14:25:57 +01:00 committed by klmp200
parent 9bb5951dac
commit baf39d8f3b

View File

@ -251,7 +251,7 @@ th {
{%- set election_lists = election.election_list.all() -%} {%- set election_lists = election.election_list.all() -%}
<caption></caption> <caption></caption>
<thead> <thead>
{%- if not election.has_voted(user) %} {%- if not election.has_voted(user) and election.can_vote(user) %}
<th>{% trans %}Blank vote{% endtrans %}</th> <th>{% trans %}Blank vote{% endtrans %}</th>
{%- endif %} {%- endif %}
{%- for election_list in election_lists %} {%- for election_list in election_lists %}
@ -265,7 +265,7 @@ th {
<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 role.max_choice > 1 and not election.has_voted(user) %} {%- if role.max_choice > 1 and not election.has_voted(user) and election.can_vote(user) %}
<strong class="role__multiple-choices-label">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong> <strong class="role__multiple-choices-label">{% trans %}You may choose up to{% endtrans %} {{ role.max_choice }} {% trans %}people.{% endtrans %}</strong>
{%- endif %} {%- endif %}
{%- if election_form.errors[role.title] is defined %} {%- if election_form.errors[role.title] is defined %}
@ -294,7 +294,7 @@ th {
<li class="list-per-role__candidate"> <li class="list-per-role__candidate">
<figure class="candidate"> <figure class="candidate">
<div class="candidate__picture-wrapper"> <div class="candidate__picture-wrapper">
{%- if candidature.user.profile_pict %} {%- 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>
@ -321,7 +321,7 @@ th {
</table> </table>
</form> </form>
</section> </section>
{%- if not election.has_voted(user) %} {%- if not election.has_voted(user) and election.can_vote(user) %}
<section class="election__sumbit-section"> <section class="election__sumbit-section">
<button class="election__sumbit-button" form="vote-form">{% trans %}Submit the vote !{% endtrans %}</button> <button class="election__sumbit-button" form="vote-form">{% trans %}Submit the vote !{% endtrans %}</button>
</section> </section>