From c7b907f1151925047d34f9e93a544e5a3cc4fd97 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Sun, 15 Jun 2025 16:37:09 +0200 Subject: [PATCH] Refactor music management UI: separate group musics into its own template, enhance form structure, and improve responsiveness Fix #5 --- base/static/css/main.css | 18 ++++- base/templates/auth/user_form.html | 24 ++++++- base/templates/registration/login.html | 16 ++--- game/templates/game/group_detail.html | 65 +----------------- game/templates/game/include/group_musics.html | 66 +++++++++++++++++++ 5 files changed, 113 insertions(+), 76 deletions(-) create mode 100644 game/templates/game/include/group_musics.html diff --git a/base/static/css/main.css b/base/static/css/main.css index 23dffab..8120679 100644 --- a/base/static/css/main.css +++ b/base/static/css/main.css @@ -179,9 +179,25 @@ table select { color: var(--pico-color-red-500);} } -table.results { +table.results, table.musics { white-space: nowrap; } .sc i { margin-right: .5em; } + +@media (width < 576px) { + [role="group"] { + display: grid; + & > :first-child { + border-radius: var(--pico-border-radius) var(--pico-border-radius) 0 0 !important; + } + & > :not(:first-child) { + margin-left: 0 !important; + margin-top: calc(var(--pico-border-width) * -1); + } + & > :last-child { + border-radius: 0 0 var(--pico-border-radius) var(--pico-border-radius) !important; + } + } +} diff --git a/base/templates/auth/user_form.html b/base/templates/auth/user_form.html index 20c40a8..c895f16 100644 --- a/base/templates/auth/user_form.html +++ b/base/templates/auth/user_form.html @@ -1,6 +1,24 @@ {% extends "base.html" %} {% load form %} {% block content %} -

Créer un compte

- {% form form submit="Créer mon compte" %} - {% endblock content %} +

Créer mon compte

+ {% for error in form.non_field_errors %}
{{ error }}
{% endfor %} +
+ {% csrf_token %} +
+ {% for field in form %} + + {% endfor %} +
+ +
+ J'ai déjà un compte +
+
+{% endblock content %} diff --git a/base/templates/registration/login.html b/base/templates/registration/login.html index 8bbb8fd..4e0394e 100644 --- a/base/templates/registration/login.html +++ b/base/templates/registration/login.html @@ -5,9 +5,9 @@
{% csrf_token %} {% for field in form %} -
- {% if field.id_for_label %} - + {% if field.id_for_label %} +
+ {% endfor %} -

+

Créer mon compte -

-

+

+
J'ai oublié mon mot de passe -

+
{% endblock content %} diff --git a/game/templates/game/group_detail.html b/game/templates/game/group_detail.html index c5165f0..90e9901 100644 --- a/game/templates/game/group_detail.html +++ b/game/templates/game/group_detail.html @@ -12,68 +12,5 @@ {% include "game/include/group_buttons.html" %} {% include "game/include/group_games.html" %} {% include "game/include/group_members.html" %} -

- Mes musiques {{ musics.count }} -

-
- - Liste des musiques - -
- {% csrf_token %} - - - - - - - - - - - {% for music in musics %} - - - - - - - {% empty %} - - - - {% endfor %} - -
MusiqueID - -
- - {{ music.title }} - {{ music.yt_id }} - - -
Aucune musique.
- {% if musics %} -
- - -
- {% endif %} -
-
-
- {% csrf_token %} -
- - -
-
+ {% include "game/include/group_musics.html" %} {% endblock content %} diff --git a/game/templates/game/include/group_musics.html b/game/templates/game/include/group_musics.html new file mode 100644 index 0000000..56117cf --- /dev/null +++ b/game/templates/game/include/group_musics.html @@ -0,0 +1,66 @@ +

+ Mes musiques {{ musics.count }} +

+
+ + Liste des musiques + +
+ {% csrf_token %} +
+ + + + + + + + + + + {% for music in musics %} + + + + + + + {% empty %} + + + + {% endfor %} + +
MusiqueID + +
+ + {{ music.title }} + {{ music.yt_id }} + + +
Aucune musique.
+
+ {% if musics %} +
+ + +
+ {% endif %} +
+
+
+ {% csrf_token %} +
+ + +
+