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:
parent
d79375365d
commit
19898e1b09
13 changed files with 551 additions and 25 deletions
|
@ -1,8 +1,30 @@
|
|||
<div class="individual_truth">
|
||||
<h3>Vérité {{ truth.number }}</h3>
|
||||
<p>{{ truth.rendered_text | safe }}</p>
|
||||
<div class="truth_tags">
|
||||
{% for tag in truth.tags %}
|
||||
<form action="/{{ week_data.number }}/untag/{{ truth.id }}" method="post">
|
||||
<button name="name" value="{{ tag.name }}">❌</button>
|
||||
</form>
|
||||
<a class="tag" href="/tags/filter?tags={{ tag.name }}" style="background-color: {{ tag.color }}">
|
||||
{{ tag.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<hr/>
|
||||
<form action="/{{ week_data.number }}/edit/{{ truth.number }}" method="POST">
|
||||
<form class="truth_edit_form" action="/{{ week_data.number }}/edit/{{ truth.number }}" method="POST">
|
||||
{% include "weeks/truth_editor" %}
|
||||
</form>
|
||||
<form class="truth_edit_form" action="/{{ week_data.number }}/tag/{{ truth.id }}" method="post">
|
||||
<label>Thème supplémentaire:
|
||||
<select name="name">
|
||||
{% for tag in tags %}
|
||||
{% if not truth.tags is containing(tag) %}
|
||||
<option value="{{ tag.name }}" style="background-color: {{ tag.color }}">{{ tag.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<button>Ajouter un thème</button>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue