Refactor game results display and scoring logic in templates and CSS
This commit is contained in:
parent
e039889488
commit
2278345f32
5 changed files with 118 additions and 40 deletions
49
game/templates/game/include/game_results.html
Normal file
49
game/templates/game/include/game_results.html
Normal file
|
@ -0,0 +1,49 @@
|
|||
{% load game %}
|
||||
{% if musikgame.over %}
|
||||
<h2>
|
||||
<i class="ri-list-ordered"></i> Résultats
|
||||
</h2>
|
||||
<details open>
|
||||
<summary role="button">
|
||||
<i class="ri-list-ordered-2"></i> Résultats
|
||||
</summary>
|
||||
<div class="overflow-auto">
|
||||
<table class="striped results">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<i class="ri-list-ordered-2"></i>
|
||||
</th>
|
||||
<th>
|
||||
<i class="ri-music-2-fill"></i> Musique
|
||||
</th>
|
||||
<th>
|
||||
<i class="ri-user-line"></i> Joueur
|
||||
</th>
|
||||
{% for player in musikgame.musicgameresults_set.all %}
|
||||
<th>{{ player.player.username }}</th>
|
||||
<th class="sc">
|
||||
{% if forloop.first %}<i class="ri-medal-fill gold"></i>{% endif %}
|
||||
<span class="score">{{ player.score }}</span>
|
||||
</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for music in musikgame.musicgameorder_set.all %}
|
||||
<tr>
|
||||
<td>{{ music.order }}</td>
|
||||
<td>
|
||||
<a href="https://youtu.be/{{ music.music_video.yt_id }}">{{ music.music_video.title }}</a>
|
||||
</td>
|
||||
<td>{{ music.player }}</td>
|
||||
{% for player in musikgame.musicgameresults_set.all %}
|
||||
{% answer player music %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
{% endif %}
|
|
@ -63,40 +63,5 @@
|
|||
{% endfor %}
|
||||
</ol>
|
||||
</details>
|
||||
{% if musikgame.over %}
|
||||
<h2>
|
||||
<i class="ri-list-ordered"></i> Résultats
|
||||
</h2>
|
||||
<details open>
|
||||
<summary role="button">
|
||||
<i class="ri-list-ordered-2"></i> Résultats
|
||||
</summary>
|
||||
<table class="striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<i class="ri-list-ordered-2"></i>
|
||||
</th>
|
||||
<th>
|
||||
<i class="ri-music-2-fill"></i> Musique
|
||||
</th>
|
||||
<th>
|
||||
<i class="ri-user-line"></i> Joueur
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for music in musikgame.musicgameorder_set.all %}
|
||||
<tr>
|
||||
<td>{{ music.order }}</td>
|
||||
<td>
|
||||
<a href="https://youtu.be/{{ music.music_video.yt_id }}">{{ music.music_video.title }}</a>
|
||||
</td>
|
||||
<td>{{ music.player }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</details>
|
||||
{% endif %}
|
||||
{% include "game/include/game_results.html" %}
|
||||
{% endblock content %}
|
||||
|
|
16
game/templates/tags/game/answer.html
Normal file
16
game/templates/tags/game/answer.html
Normal file
|
@ -0,0 +1,16 @@
|
|||
{% if empty %}
|
||||
<td class="empty"></td>
|
||||
<td class="empty sc">
|
||||
<i class="ri-checkbox-blank-circle-fill"></i><span class="score">{{ score }}</span>
|
||||
</td>
|
||||
{% elif correct %}
|
||||
<td class="correct">{{ answer }}</td>
|
||||
<td class="correct sc">
|
||||
<i class="ri-checkbox-circle-fill"></i><span class="score">{{ score }}</span>
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="wrong">{{ answer }}</td>
|
||||
<td class="wrong sc">
|
||||
<i class="ri-close-circle-fill"></i><span class="score">{{ score }}</span>
|
||||
</td>
|
||||
{% endif %}
|
Loading…
Add table
Add a link
Reference in a new issue