Edició de llistes (afegir i esborrar llistes)

This commit is contained in:
marc
2025-12-21 17:30:19 +01:00
parent fdcda1b566
commit c0624d1e56
10 changed files with 101 additions and 19 deletions

View File

@@ -12,4 +12,4 @@
hx-swap="outerHTML">
<i class="fa fa-eye-slash" aria-hidden="true"></i>
</button>
{% endif %}
{% endif %}

View File

@@ -1,16 +1,26 @@
{% include "fragments/menu.html" %}
<div class="p-12 text-center">
<h3 class="text-3xl text-beige p-4">Llistes de Repertori</h3>
{% if logged_in %}
<button title="Afegeix una llista"
class="text-beige m-2"
hx-post="/api/llistes/editor/"
hx-target="#{{ playlist_list_id }}"
hx-swap="afterbegin transition:true">
<i class="fa fa-plus" aria-hidden="true"></i>
Afegeix una llista
</button>
{% endif %}
<div id="{{ playlist_list_id }}"
class="flex flex-col items-center">
{% if playlists %}
<div class="flex flex-col items-center">
{% for playlist in playlists %}
{% include "fragments/llistes/playlist_entry.html" %}
{% endfor %}
</div>
{% else %}
<div class="text-center py-8">
<p class="text-beige/70">No hi ha llistes disponibles.</p>
</div>
{% endif %}
</div>
</div>

View File

@@ -1,7 +1,8 @@
<div class="
border rounded border-beige
p-2 m-2 w-full max-w-xl
">
relative"
id="playlist-entry-{{ playlist.id }}">
<div class="flex justify-between items-start">
<div class="flex-1">
<p class="text-xl text-white">
@@ -9,15 +10,22 @@
{% if playlist.name %}
{{ playlist.name }}
{% else %}
Llista de temes #{{ playlist.id }}
Llista de temes
{% endif %}
</a>
</p>
</div>
{% if logged_in %}
<div class="ml-2">
{% include "fragments/llista/visibility.html" %}
{% if logged_in %}
<div class="ml-auto">
{% include "fragments/llistes/playlist_visibility.html" %}
<button title="Esborra la llista"
class="text-beige mx-1"
hx-delete="/api/llistes/{{ playlist.id }}"
hx-target="#playlist-entry-{{ playlist.id }}"
hx-swap="outerHTML swap:0.5s">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,15 @@
{% if not playlist.hidden %}
<button title="Llista visible (amaga-la)"
class="text-beige mx-2"
hx-put="/api/llista/{{ playlist.id }}/invisible"
hx-swap="outerHTML">
<i class="fa fa-eye" aria-hidden="true"></i>
</button>
{% else %}
<button title="Llista invisible (mostra-la)"
class="text-beige mx-2"
hx-put="/api/llista/{{ playlist.id }}/visible"
hx-swap="outerHTML">
<i class="fa fa-eye-slash" aria-hidden="true"></i>
</button>
{% endif %}