{% set title = "Vérités Fabula Ultima" %} {{ title }} {% if user.logged_in == true and not user.is_admin %} {% endif %} {# Check if the user has a vote in advance, for readability #} {% if user.logged_in == true and user.has_week_vote == true%} {% set has_vote = true %} {% else %} {% set has_vote = false %} {% endif -%}

{{ title }}

{% if user.logged_in == true %}

Connecté en tant que {{ user.name }}

{% else %}
{% endif %}

Semaine {{ week_number }}

{% if user.logged_in == true and user.is_admin == false %}
{% endif %} {# Truths start at 1 but the array starts at 0 #} {% set index_delta = 1 %} {% for truth in truths %} {# The truths are in an ordered array, but one of them might be the user's. In this case, we need to stop the array index from incrementing if the current truth is the user's, as they cannot have voted for themselves, leading to one less votes than there are truths. #} {%- if truth.author_id == user.id -%} {%- set_global index_delta = 2 -%} {% endif %} {% set truth_index = truth.number - index_delta %} {% if user.is_admin == true %} {% include "editable_truth" %} {% else %} {% include "truth" %} {% endif %} {% endfor %} {% if user.logged_in == true and user.is_admin == false %}
{% endif %} {# If admin, show an additional box for creating a new Truth. #} {% if user.is_admin == true %}

Nouvelle vérité

{% include "truth_editor" %}
{% endif %}