Desacoblar playlists de sessions i afegir slow jams

This commit is contained in:
marc
2025-11-01 19:55:24 +01:00
parent 23337f8ab3
commit 2fbdbbf290
41 changed files with 705 additions and 1418 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1,14 @@
<ul id="playlist-{{ session.id }}" class="">
<ul id="playlist-{{ playlist_id }}" class="">
{% for set_entry in playlist.sets %}
{% set set_id = set_entry.id %}
{% include "fragments/sessio/set_entry.html" %}
{% include "fragments/playlist/set_entry.html" %}
{% endfor %}
</ul>
{% if logged_in %}
<div class="flex flex-col items-center">
<button class="text-beige mt-2"
hx-post="/api/sessio/{{ session.id }}/playlist/set"
hx-target="#playlist-{{ session.id }}"
hx-post="/api/playlist/{{ playlist_id }}/set"
hx-target="#playlist-{{ playlist_id }}"
hx-swap="beforeend transition:true">
<i class="fa fa-plus" aria-hidden="true"></i>
Afegeix set

View File

@@ -0,0 +1,2 @@
{% include "fragments/menu.html" %}
{% include "fragments/playlist/set/set_page.html" %}

View File

@@ -13,14 +13,14 @@
{% for tema_in_set in set.temes %}
{% if tema_in_set.tema is not none %}
{% set tema = tema_in_set.tema %}
{% include "fragments/sessio/set/tema_title.html" %}
{% include "fragments/playlist/set/tema_title.html" %}
{% else %}
<h3 class="text-center text-3xl p-4"> <i>Desconegut</i> </h3>
{% endif %}
{% endfor %}
<div class="mx-12">
<hr class="h-px mt-1 mb-3 bg-beige border-0">
{% include "fragments/sessio/set/set_score.html"%}
{% include "fragments/playlist/set/set_score.html"%}
</div>
{% else %}
{% for tema_in_set in set.temes %}
@@ -31,7 +31,7 @@
{% endif %}
{% if tema_in_set.tema is not none %}
{% set tema = tema_in_set.tema %}
{% include "fragments/sessio/set/tema.html"%}
{% include "fragments/playlist/set/tema.html"%}
{% else %}
<h3 class="text-center text-3xl p-4">
<i>Desconegut</i>

View File

@@ -1,4 +1,4 @@
{% include "fragments/sessio/set/tema_title.html" %}
{% include "fragments/playlist/set/tema_title.html" %}
<div class="mx-12 text-left">
{% if tema.main_score() is not none %}

View File

@@ -2,12 +2,12 @@
m-4 rounded-lg bg-white
px-2 py-1 my-1"
id="set-entry-{{ set_id }}"
hx-get="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}"
hx-get="/api/playlist/{{ playlist_id }}/set/{{ set_id }}"
hx-target="#set-entry-{{ set_id }}"
hx-swap="outerHTML"
hx-trigger="reload-set-{{ set_id }}">
{% if set_entry.temes | length > 1 or not set_entry.temes[0].tema %}
{% set set_url = "/sessio/%d/set/%d" | format(session_id, set_id) %}
{% set set_url = "/playlist/%d/set/%d" | format(playlist_id, set_id) %}
{% else %}
{% set set_url = "/tema/%d" | format(set_entry.temes[0].tema_id) %}
{% endif %}
@@ -25,7 +25,7 @@
w-full max-w-[655px]">
{% if logged_in %}
<button class="text-beige w-full"
hx-delete="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}"
hx-delete="/api/playlist/{{ playlist_id }}/set/{{ set_id }}"
hx-target="#set-entry-{{ set_id }}"
hx-swap="outerHTML">
<i class="fa fa-times" aria-hidden="true"></i>
@@ -36,15 +36,15 @@
class="flex flex-col items-start w-full">
{% for tema_entry in set_entry.temes %}
{% if new_entry %}
{% include "fragments/sessio/tema_editor.html" %}
{% include "fragments/playlist/tema_editor.html" %}
{% else %}
{% include "fragments/sessio/tema_entry.html" %}
{% include "fragments/playlist/tema_entry.html" %}
{% endif %}
{% endfor %}
</ol>
{% if logged_in %}
<button class="text-beige mt-2 w-full"
hx-post="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}"
hx-post="/api/playlist/{{ playlist_id }}/set/{{ set_id }}"
hx-target="#set-entry-{{ set_id }}-list"
hx-swap="beforeend transition:true">
<i class="fa fa-plus" aria-hidden="true"></i>

View File

@@ -12,13 +12,13 @@
class="border border-beige focus:outline-none
rounded text-center text-black
p-1 m-1"
hx-get="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}/tema/{{ tema_entry.id }}/busca"
hx-get="/api/playlist/{{ playlist_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}/busca"
hx-trigger="revealed, keyup delay:500ms changed"
hx-target="#tune-entry-{{ tema_entry.id }}-search-results"
hx-swap="outerHTML"/>
<button title="Descarta els canvis"
class="text-beige mx-1"
hx-get="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}/tema/{{ tema_entry.id }}"
hx-get="/api/playlist/{{ playlist_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}"
hx-target="#tune-entry-{{ tema_entry.id }}"
hx-swap="outerHTML">
<i class="fa fa-times" aria-hidden="true"></i>

View File

@@ -15,14 +15,14 @@
<div class="flex-none flex flex-row shrink-0">
<button title="Edita el tema"
class="text-beige mx-1"
hx-get="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}/tema/{{ tema_entry.id }}/editor"
hx-get="/api/playlist/{{ playlist_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}/editor"
hx-target="#tune-entry-{{ tema_entry.id }}"
hx-swap="outerHTML">
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
<button title="Esborra el tema"
class="text-beige mx-1"
hx-delete="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}/tema/{{ tema_entry.id }}"
hx-delete="/api/playlist/{{ playlist_id }}/set/{{ set_id }}/tema/{{ tema_entry.id }}"
hx-target="#tune-entry-{{ tema_entry.id }}"
hx-swap="outerHTML">
<i class="fa fa-times" aria-hidden="true"></i>

View File

@@ -4,7 +4,7 @@
<li>
<button class="bg-beige text-brown rounded
m-1 px-2"
hx-put="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}/tema/{{ entry_id }}"
hx-put="/api/playlist/{{ playlist_id }}/set/{{ set_id }}/tema/{{ entry_id }}"
hx-vals='{"tema_id": "{{ tema.id }}"}'
hx-target="#tune-entry-{{ entry_id }}"
hx-swap="outerHTML">
@@ -15,7 +15,7 @@
<li>
<button class="border border-beige text-beige rounded
m-1 px-2"
hx-put="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}/tema/{{ entry_id }}/unknown"
hx-put="/api/playlist/{{ playlist_id }}/set/{{ set_id }}/tema/{{ entry_id }}/unknown"
hx-target="#tune-entry-{{ entry_id }}"
hx-swap="outerHTML">
<i class="fa fa-question" aria-hidden="true"></i>
@@ -25,7 +25,7 @@
<li>
<button class="border border-beige text-beige rounded
m-1 px-2"
hx-post="/api/sessio/{{ session_id }}/playlist/set/{{ set_id }}/tema/{{ entry_id }}"
hx-post="/api/playlist/{{ playlist_id }}/set/{{ set_id }}/tema/{{ entry_id }}"
hx-vals='{"title": "{{ query }}"}'
hx-target="#tune-entry-{{ entry_id }}"
hx-swap="outerHTML">

View File

@@ -0,0 +1,13 @@
<h4 class="py-4 text-xl text-beige">
Notes
{% if logged_in %}
<button title="Edita les notes"
class="mx-1"
hx-get="/api/sessio/{{ session_id }}/notes/editor"
hx-target="#notes"
hx-swap="innerHTML">
<i class="fa fa-pencil" aria-hidden="true"></i>
</button>
{% endif %}
</h4>
{{ notes | safe }}

View File

@@ -0,0 +1,28 @@
<h4 class="py-4 text-xl text-beige">Notes</h4>
<form id="notes-form"
class="w-full">
<h5 class="text-sm text-beige text-right">
<button title="Desa els canvis"
class="mx-1"
hx-put="/api/sessio/{{session_id}}/notes"
hx-target="#notes"
hx-swap="innerHTML">
<i class="fa fa-check" aria-hidden="true"></i>
</button>
<button title="Descarta els canvis"
class="mx-1"
hx-get="/api/sessio/{{session_id}}/notes"
hx-target="#notes"
hx-swap="innerHTML">
<i class="fa fa-times" aria-hidden="true"></i>
</button>
</h5>
<hr class="h-px mt-1 mb-3 bg-beige border-0">
<textarea name="content"
placeholder="Notes"
rows="{{ max(notes.count('\n') + 1, 5) }}"
class="border border-beige focus:outline-none
w-full text-left
rounded
bg-brown p-2 m-0">{{notes}}</textarea>
</form>

View File

@@ -31,20 +31,26 @@
{% endif %}
</div>
{% if logged_in or session.notes %}
<div class="text-left">
<h4 class="py-4 text-xl text-beige">Notes</h4>
{% if session.notes %}{{ session.notes }}{% endif %}
<div id="notes"
class="text-left">
{% set notes = session.notes if session.notes else "" %}
{% include "fragments/sessio/notes.html" %}
</div>
{% endif %}
{% if logged_in or False %}
{% if logged_in or (session.slowjam and session.slowjam.sets) %}
<div class="text-left">
<h4 class="py-4 text-xl text-beige">Slow Jam</h4>
<h4 class="py-4 text-xl text-beige mt-2">Slow Jam</h4>
{% set playlist_id = session.slowjam.id %}
{% set playlist = session.slowjam %}
{% include "fragments/playlist/playlist.html" %}
</div>
{% endif %}
{% if logged_in or playlist.sets %}
{% if logged_in or (session.setlist and session.setlist.sets) %}
<div class="text-left">
<h4 class="py-4 text-xl text-beige mt-2">Temes tocats</h4>
{% include "fragments/sessio/playlist.html" %}
{% set playlist_id = session.setlist.id %}
{% set playlist = session.setlist %}
{% include "fragments/playlist/playlist.html" %}
</div>
{% endif %}
</div>

View File

@@ -1,2 +0,0 @@
{% include "fragments/menu.html" %}
{% include "fragments/sessio/set/set_page.html" %}