index: Remove the form if all votes were cast

Currently, if all votes are cast and the week is locked the selections are disabled but
the form and button still exist and might cause confusion.
Remove them if all votes are cast and we are not on the last week anymore.
This commit is contained in:
trotFunky 2024-07-26 17:55:39 +01:00
parent 4e1b13dc85
commit ba98c3be84

View file

@ -36,6 +36,9 @@
{% set next_arrow_chara = '⟹' %} {% set next_arrow_chara = '⟹' %}
{% endif %} {% endif %}
{# Remove the form if all votes are locked, to reduce confusion. #}
{% set lock_truth_form = user.votes | length + 1 == truths | length and week_data.is_last_week != true %}
<body> <body>
<div class="top_bar"> <div class="top_bar">
<h1>{{ title }}</h1> <h1>{{ title }}</h1>
@ -76,7 +79,7 @@
</form> </form>
{% endif %} {% endif %}
</div> </div>
{% if user.logged_in == true and user.is_admin == false %} {% if user.logged_in == true and user.is_admin == false and not lock_truth_form %}
<form id="truths" action="/{{ week_data.number }}/vote" method="POST"> <form id="truths" action="/{{ week_data.number }}/vote" method="POST">
{% endif %} {% endif %}
@ -101,7 +104,7 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if user.logged_in == true and user.is_admin == false %} {% if user.logged_in == true and user.is_admin == false and not lock_truth_form %}
<br/> <br/>
<button form="truths"> <button form="truths">
{%- if user.logged_in == true and user.has_week_vote == true -%} {%- if user.logged_in == true and user.has_week_vote == true -%}