tag: Introduce tag system

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.
This commit is contained in:
trotFunky 2024-08-01 21:18:30 +01:00
parent d79375365d
commit 19898e1b09
13 changed files with 551 additions and 25 deletions

View file

@ -7,6 +7,12 @@
<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>