forked from mirrors/bookwyrm
101 lines
4.1 KiB
HTML
101 lines
4.1 KiB
HTML
{% extends 'layout.html' %}
|
|
{% block content %}
|
|
{% with book_results|first as local_results %}
|
|
<div class="block">
|
|
<h1 class="title">Search Results for "{{ query }}"</h1>
|
|
</div>
|
|
|
|
<div class="block columns">
|
|
<div class="column">
|
|
<h2 class="title">{% trans "Matching Books" %}</h2>
|
|
<section class="block">
|
|
{% if not local_results.results %}
|
|
<p>{% blocktrans %}No books found for "{{ query }}"{% endblocktrans %}</p>
|
|
{% else %}
|
|
<ul>
|
|
{% for result in local_results.results %}
|
|
<li class="pd-4">
|
|
<a href="{{ result.key }}">{% include 'snippets/search_result_text.html' with result=result link=True %}</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</section>
|
|
|
|
{% if request.user.is_authenticated %}
|
|
{% if book_results|slice:":1" and local_results.results %}
|
|
<div class="block">
|
|
<p>
|
|
{% trans "Didn't find what you were looking for?" %}
|
|
</p>
|
|
{% include 'snippets/toggle/open_button.html' with text="Show results from other catalogues" small=True controls_text="more-results" %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="{% if local_results.results %}hidden{% endif %}" id="more-results">
|
|
{% for result_set in book_results|slice:"1:" %}
|
|
{% if result_set.results %}
|
|
<section class="block">
|
|
{% if not result_set.connector.local %}
|
|
<h3 class="title is-5">
|
|
Results from <a href="{{ result_set.connector.base_url }}" target="_blank">{% if result_set.connector.name %}{{ result_set.connector.name }}{% else %}{{ result_set.connector.identifier }}{% endif %}</a>
|
|
</h3>
|
|
{% endif %}
|
|
|
|
<ul>
|
|
{% for result in result_set.results %}
|
|
<li class="pb-4">
|
|
<form action="/resolve-book" method="POST">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="remote_id" value="{{ result.key }}">
|
|
<div>{% include 'snippets/search_result_text.html' with result=result link=False %}</div>
|
|
<button type="submit" class="button is-small is-link">{% trans "Import book" %}</button>
|
|
</form>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</section>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if local_results.results %}
|
|
{% include 'snippets/toggle/close_button.html' with text="Hide results from other catalogues" small=True controls_text="more-results" %}
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="column">
|
|
<section class="block">
|
|
<h2 class="title">{% trans "Matching Users" %}</h2>
|
|
{% if not user_results %}
|
|
<p>{% blocktrans %}No users found for "{{ query }}"{% endblocktrans %}</p>
|
|
{% endif %}
|
|
<ul>
|
|
{% for result in user_results %}
|
|
<li class="block">
|
|
{% include 'snippets/avatar.html' with user=result %}</h2>
|
|
{% include 'snippets/username.html' with user=result show_full=True %}</h2>
|
|
{% include 'snippets/follow_button.html' with user=result %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</section>
|
|
<section class="block">
|
|
<h2 class="title">{% trans "Lists" %}</h2>
|
|
{% if not list_results %}
|
|
<p>{% blocktrans %}No lists found for "{{ query }}"{% endblocktrans %}</p>
|
|
{% endif %}
|
|
{% for result in list_results %}
|
|
<div class="block">
|
|
<ul>
|
|
<li>
|
|
<a href="{% url 'list' result.id %}">{{ result.name }}</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</section>
|
|
</div>
|
|
</div>
|
|
{% endwith %}
|
|
{% endblock %}
|