Files
folkugat-web/folkugat_web/assets/templates/fragments/temes/results.html
2025-04-27 17:00:04 +02:00

64 lines
2.0 KiB
HTML

<div id="search-results"
class="min-w-full w-full">
{% if logged_in and query %}
<button title="Afegeix un tema"
class="border border-beige text-beige rounded
m-1 px-2"
hx-post="/api/tema"
hx-include="[name=query]"
hx-vals="js:{title: document.getElementById('query-input').value}"
>
<i class="fa fa-plus" aria-hidden="true"></i>
<i>{{ query }}</i>
</button>
{% endif %}
<ul class="text-left min-w-full w-full">
{% for tema in temes %}
<li class="flex flex-col
m-4 rounded-lg
bg-white">
<div class="py-2 px-4 text-brown font-bold">
<a href="/tema/{{ tema.id }}">
{{ tema.title }}
</a>
</div>
{% if tema.main_score() and tema.main_score().preview_url %}
<img class="p-2 max-w"
src="{{ tema.main_score().preview_url }}" />
{% endif %}
{% if tema.properties %}
<ul class="flex flex-wrap text-sm
py-2 px-4">
{% for property in tema.properties %}
<div class="bg-beige text-white rounded
m-1 px-2">
{{ property.value }}
</div>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
{% if prev_offset is not none or next_offset is not none %}
<div class="py-2">
{% if prev_offset is not none %}
<button class="text-beige mx-2"
hx-get="/api/temes/busca?query={{ query }}&offset={{ prev_offset }}"
hx-target="#search-results"
hx-swap="outerHTML">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
</button>
{% endif %}
{% if next_offset is not none %}
<button class="text-beige mx-2"
hx-get="/api/temes/busca?query={{ query }}&offset={{ next_offset }}"
hx-target="#search-results"
hx-swap="outerHTML">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</button>
{% endif %}
</div>
{% endif %}
</div>