trotFunky
19898e1b09
Create a new table representing tags, composed of a name and color. They can be used to tag truths and filter them later. Tags display under the truths they correspond to and can be clicked to access all truths matching this tag. Introduce a new element in the top bar to allow navigating to the tag list, which can be used to create and edit tags for the admin and used to select a list of tags to filter against for everyone. Update the database records of the truths to include the tag vector. As the database query result is a multi-row result, it cannot be parsed automatically so it needs to be skipped and retrieved manually.
40 lines
1.6 KiB
Text
40 lines
1.6 KiB
Text
{%- 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 vote_data.votes | filter(attribute="truth_id", value=truth.id) -%}
|
|
{%- set is_disabled = "disabled" -%}
|
|
{%- endif -%}
|
|
|
|
<div class="individual_truth">
|
|
<a href="/{{ truth.week }}/#{{ truth.number }}"><h3 id="{{ truth.number }}">Vérité {{ truth.number }}</h3></a>
|
|
<p>{{ truth.rendered_text | safe }}</p>
|
|
<hr>
|
|
<div class="truth_tags">
|
|
{% for tag in truth.tags %}
|
|
<a class="tag" href="/tags/filter?tags={{ tag.name }}" style="background-color: {{ tag.color }}">{{ tag.name }}</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% if user.logged_in %}
|
|
<hr/>
|
|
<label>
|
|
{%- if truth.author_id == user.id -%}
|
|
Tu l'as fait :)
|
|
{%- else -%}
|
|
Qui l'a fait ?
|
|
<select form="truths" name="truth_votes[{{ truth.id }}]" {{ is_disabled }}>
|
|
<option value="0">---</option>
|
|
{% for player in other_players %}
|
|
{# Check if we should pre-select an existing vote. #}
|
|
{% set_global is_selected = "" %}
|
|
{% for vote in vote_data.votes %}
|
|
{% if truth.id == vote.truth_id and player.id == vote.voted_id %}
|
|
{% set_global is_selected = "selected" %}
|
|
{% break %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
<option value="{{ player.id }}" {{- is_selected -}}>{{ player.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
{%- endif -%}
|
|
</label>
|
|
{% endif %}
|
|
</div>
|