templates/truth: Prevent changing vote if not last week
If the week is not active anymore, prevent changing any vote but allow adding missing ones.
This commit is contained in:
parent
207ce6c1d2
commit
dfdd079ac4
1 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
{%- set is_disabled = "" -%}
|
||||||
|
{# If we are not during the active week, prevent changing vote but not sending a missing one. #}
|
||||||
|
{%- if week_data.is_last_week != true and user.votes | filter(attribute="truth_id", value=truth.id) -%}
|
||||||
|
{%- set is_disabled = "disabled" -%}
|
||||||
|
{%- endif -%}
|
||||||
|
|
||||||
<div class="individual_truth">
|
<div class="individual_truth">
|
||||||
<h3>Vérité {{ truth.number }}</h3>
|
<h3>Vérité {{ truth.number }}</h3>
|
||||||
<p>{{ truth.rendered_text | safe }}</p>
|
<p>{{ truth.rendered_text | safe }}</p>
|
||||||
|
@ -8,10 +14,10 @@
|
||||||
Tu l'as fait :)
|
Tu l'as fait :)
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
Qui l'a fait ?
|
Qui l'a fait ?
|
||||||
<select form="truths" name="truth_votes[{{ truth.id }}]">
|
<select form="truths" name="truth_votes[{{ truth.id }}]" {{ is_disabled }}>
|
||||||
<option value="0">---</option>
|
<option value="0">---</option>
|
||||||
{% for player in other_players %}
|
{% for player in other_players %}
|
||||||
{# Check if we should pre-select an existing vote #}
|
{# Check if we should pre-select an existing vote. #}
|
||||||
{% set_global is_selected = "" %}
|
{% set_global is_selected = "" %}
|
||||||
{% for vote in user.votes %}
|
{% for vote in user.votes %}
|
||||||
{% if truth.id == vote.truth_id and player.id == vote.voted_id %}
|
{% if truth.id == vote.truth_id and player.id == vote.voted_id %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue