Refactor group music management: update removal logic and enhance user feedback in group views

This commit is contained in:
Edgar P. Burkhart 2025-06-14 12:09:07 +02:00
parent 094c5c104d
commit 7ed5cfcb83
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 62 additions and 37 deletions

View file

@ -114,31 +114,31 @@
<summary role="button">
<i class="ri-music-2-fill"></i> Liste des musiques
</summary>
<table class="striped">
<thead>
<tr>
<th>Musique</th>
<th>ID</th>
<th>
<i class="ri-history-fill"></i>
</th>
<th>
<i class="ri-delete-bin-fill"></i>
</th>
</tr>
</thead>
<tbody>
{% for music in musics %}
<form method="post">
{% csrf_token %}
<table class="striped">
<thead>
<tr>
<th>{{ music.title }}</th>
<td>
<a href="https://youtu.be/{{ music.yt_id }}">{{ music.yt_id }}</a>
</td>
<td>
<input type="checkbox" disabled {% if music.blacklisted %}checked{% endif %}
<th></th>
<th>Musique</th>
<th>ID</th>
<th>
<i class="ri-history-fill"></i>
</th>
</tr>
</thead>
<tbody>
{% for music in musics %}
<tr>
<td>
<input type="checkbox" name="musics" value="{{ music.pk }}">
</td>
<th>{{ music.title }}</th>
<td>
<a href="https://youtu.be/{{ music.yt_id }}">{{ music.yt_id }}</a>
</td>
<td>
<a href="{% url "group_remove_music" pk=music.pk %}"><i class="ri-close-fill" alt="Supprimer"></i></a>
<input type="checkbox" disabled {% if music.blacklisted %}checked{% endif %}>
</td>
</tr>
{% empty %}
@ -148,12 +148,18 @@
{% endfor %}
</tbody>
</table>
</details>
<form method="post" action="{% url "group_add_music" pk=group.pk %}">
{% csrf_token %}
<fieldset role="group">
<input type="string" name="yt_id" id="yt_id" placeholder="Musique" required>
<button type="submit">Ajouter</button>
</fieldset>
{% if musics %}
<button type="submit" formaction="{% url "group_remove_music" pk=group.pk %}">
<i class="ri-delete-bin-fill"></i> Supprimer les musiques sélectionnées
</button>
{% endif %}
</form>
{% endblock content %}
</details>
<form method="post" action="{% url "group_add_music" pk=group.pk %}">
{% csrf_token %}
<fieldset role="group">
<input type="string" name="yt_id" id="yt_id" placeholder="Musique" required>
<button type="submit">Ajouter</button>
</fieldset>
</form>
{% endblock content %}