musik/game/templates/game/group_detail.html

101 lines
3.6 KiB
HTML

{% extends "base.html" %}
{% load form %}
{% block content %}
<h1>
<i class="ri-group-2-fill"></i> {{ group.name }}
</h1>
{% if group.owner == user %}
<p>
<a href="{% url "group_update" pk=group.pk %}"><i class="ri-edit-line"></i> Modifier le groupe</a>
</p>
<p>
<a href="{% url "start_game" pk=group.pk %}" role="button"><i class="ri-play-fill"></i> Lancer une partie</a>
<a href="{% url "group_clear_blacklist" pk=group.pk %}" role="button"><i class="ri-history-fill"></i> Effacer la blacklist</a>
</p>
{% endif %}
{% if group.musikgame_set %}
<h2>
<i class="ri-play-circle-fill"></i> Parties
</h2>
<table class="striped">
<thead>
<th>Date</th>
<th>Joueurs</th>
<th>
<i class="ri-delete-bin-fill"></i>
</th>
</thead>
<tbody>
{% for game in group.musikgame_set.all %}
<tr>
<td>
<a href="{% url "game_detail" pk=game.pk %}">{{ game.date }}</a>
</td>
<td>{{ game.players.all|join:", " }}</td>
<td>
<a href="{% url "group_remove_game" pk=game.pk %}"><i class="ri-close-fill" alt="Supprimer"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<h2>
<i class="ri-group-2-fill"></i> Membres
</h2>
{% if group.owner == user %}
<p>
<a href="{% url "group_edit_members" pk=group.pk %}" role="button"><i class="ri-user-add-fill"></i> Modifier les membres</a>
</p>
{% endif %}
<ul>
<li>
{{ group.owner }} ({{ owner_count }}) <i class="ri-vip-crown-fill"></i>
</li>
{% for member in members.all %}<li>{{ member }} ({{ member.count }})</li>{% endfor %}
</ul>
<h2>
<i class="ri-music-2-fill"></i> Mes musiques ({{ musics.count }})
</h2>
<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 %}
<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 %}
</td>
<td>
<a href="{% url "group_remove_music" pk=music.pk %}"><i class="ri-close-fill" alt="Supprimer"></i></a>
</td>
</tr>
{% empty %}
<tr>
<td colspan="2">Aucune musique.</td>
</tr>
{% endfor %}
</tbody>
</table>
<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 %}