lib.itmens/catalog/templates/search_results.html
2025-02-07 15:14:36 +00:00

102 lines
5.3 KiB
HTML

{% load static %}
{% load i18n %}
{% load l10n %}
{% load humanize %}
{% load mastodon %}
{% load duration %}
{% load thumb %}
{% get_current_language as LANGUAGE_CODE %}
<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE }}" class="classic-page nav-page-search">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ site_name }} - {{ request.GET.q }} - {% trans 'Search Results' %}</title>
{% include "common_libs.html" %}
</head>
<body>
{% include '_header.html' %}
<main>
<div class="grid__main">
<div>
<div>
{% if request.GET.q %}
{% include "search_header.html" %}
{% endif %}
{% if request.GET.tag %}
<h5>{% trans 'tag' %}: “{{ request.GET.tag }}”</h5>
{% endif %}
<div class="item-card-list">
{% for item in items %}
{% include '_list_item.html' %}
{% empty %}
<p>
{% trans "No items matching your search query." %}
{% if request.user.is_authenticated %}
{% trans "System will search other websites and instances, click title of the item to save them locally. " %}
{% endif %}
</p>
<p>
{% blocktrans %}If you have URL from one of these sites, please put the full URL (e.g. <code>https://www.imdb.com/title/tt2513074/</code>) to the search box and press Enter.{% endblocktrans %}
{% for site in sites %}
{% trans site %}
{% if not forloop.last %}/{% endif %}
{% endfor %}
</p>
{% endfor %}
</div>
{% if dup_items %}
<p class="empty">
{% blocktrans with dups=dup_items|length %} {{ dups }} items are from the same work or have the same identifier, they are hidden from the search results, <a _="on click toggle .unfold on #dup">click here to show them.</a> {% endblocktrans %}
</p>
<div class="item-card-list folded" id="dup">
{% for item in dup_items %}
{% include '_list_item.html' %}
{% endfor %}
</div>
{% endif %}
<div class="item-card-list">
{% if request.GET.q and request.user.is_authenticated %}
<p hx-get="{% url 'catalog:external_search' %}?q={{ request.GET.q }}&amp;c={{ request.GET.c }}&amp;page={% if pagination.current_page %}{{ pagination.current_page }}{% else %}1{% endif %}"
hx-trigger="load"
hx-swap="outerHTML">
<span><i class="fa-solid fa-compact-disc fa-spin loading"></i></span>
{% trans 'Searching from other sites' %}
</p>
{% else %}
{% trans "Logged in user may see search results from other sites." %}
{% endif %}
</div>
</div>
<div class="pagination">
{% if pagination.has_prev %}
<a href="?page=1&amp;{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}"
class="pagination__nav-link pagination__nav-link">&laquo;</a>
<a href="?page={{ pagination.previous_page }}&amp;{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}"
class="pagination__nav-link pagination__nav-link--right-margin pagination__nav-link">&lsaquo;</a>
{% endif %}
{% for page in pagination.page_range %}
{% if page == pagination.current_page %}
<a href="?page={{ page }}&amp;{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}"
class="pagination__page-link pagination__page-link--current">{{ page }}</a>
{% else %}
<a href="?page={{ page }}&amp;{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}"
class="pagination__page-link">{{ page }}</a>
{% endif %}
{% endfor %}
{% if pagination.has_next %}
<a href="?page={{ pagination.next_page }}&amp;{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}"
class="pagination__nav-link pagination__nav-link--left-margin">&rsaquo;</a>
<a href="?page={{ pagination.last_page }}&amp;{% if request.GET.q %}q={{ request.GET.q }}{% elif request.GET.tag %}tag={{ request.GET.tag }}{% endif %}{% if request.GET.c %}&c={{ request.GET.c }}{% endif %}"
class="pagination__nav-link">&raquo;</a>
{% endif %}
</div>
</div>
</div>
<aside class="grid__aside bottom">
{% include "_sidebar_search.html" %}
</aside>
</main>
{% include '_footer.html' %}
</body>
</html>