templates: Don't show the tagging form if no tags

If there are no tags but the form is still shown, the admin
could ask to add an empty tag returning an error 422
unprocessable entity.
Remove if there are no tags available
This commit is contained in:
trotFunky 2024-08-01 22:49:41 +01:00
parent 4d5a423c78
commit 76de321d41
3 changed files with 16 additions and 14 deletions

2
Cargo.lock generated
View file

@ -578,7 +578,7 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]] [[package]]
name = "fabula_votes_server" name = "fabula_votes_server"
version = "1.4.0" version = "1.4.1"
dependencies = [ dependencies = [
"argon2", "argon2",
"blake2", "blake2",

View file

@ -3,7 +3,7 @@ name = "fabula_votes_server"
license = "MPL-2.0" license = "MPL-2.0"
readme = "README.md" readme = "README.md"
authors = ["trotFunky"] authors = ["trotFunky"]
version = "1.4.0" version = "1.4.1"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View file

@ -15,6 +15,7 @@
<form class="truth_edit_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" %} {% include "weeks/truth_editor" %}
</form> </form>
{% if tags | length > 0 and tags | length > truth.tags | length %}
<form class="truth_edit_form" action="/{{ week_data.number }}/tag/{{ truth.id }}" method="post"> <form class="truth_edit_form" action="/{{ week_data.number }}/tag/{{ truth.id }}" method="post">
<label>Thème supplémentaire: <label>Thème supplémentaire:
<select name="name"> <select name="name">
@ -27,4 +28,5 @@
</label> </label>
<button>Ajouter un thème</button> <button>Ajouter un thème</button>
</form> </form>
{% endif %}
</div> </div>