Files
folkugat-web/folkugat_web/assets/templates/fragments/temes/results.html
2025-07-27 20:28:11 +02:00

77 lines
2.5 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="flex flex-wrap justify-center my-4">
{% for property in properties %}
<li>
<button class="bg-beige rounded
text-white
m-1 px-2"
hx-get="/api/content/temes"
hx-target="#content"
hx-include="[name=query]"
hx-vars="properties:{{ remove_property_str(property) }}"
hx-swap="innerHTML"
>
{{ property }}
</button>
</li>
{% endfor %}
{% for property in property_results %}
<li>
<button class="border border-beige rounded
text-white
m-1 px-2"
hx-get="/api/content/temes"
hx-target="#content"
hx-vars="properties:{{ add_property_str(property) }}"
hx-swap="innerHTML"
>
{{ property }}
</button>
</li>
{% endfor %}
</ul>
<hr class="h-px mt-1 mb-3 bg-beige border-0">
<ul class="min-w-full w-full">
{% for tema in temes %}
{% include "fragments/temes/result.html" %}
{% 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"
hx-include="[name=query]"
hx-vars="properties:{{ properties_str }},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"
hx-include="[name=query]"
hx-vars="properties:{{ properties_str }},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>