2020-10-14 16:19:23 +00:00
|
|
|
{% extends 'layout.html' %}
|
2021-02-28 02:48:10 +00:00
|
|
|
{% load i18n %}
|
2021-02-28 18:00:36 +00:00
|
|
|
|
|
|
|
{% block title %}{% trans "Search Results" %}{% endblock %}
|
|
|
|
|
2020-10-14 16:19:23 +00:00
|
|
|
{% block content %}
|
2020-11-02 17:03:48 +00:00
|
|
|
{% with book_results|first as local_results %}
|
2020-11-18 20:31:53 +00:00
|
|
|
<div class="block">
|
2021-02-28 02:48:10 +00:00
|
|
|
<h1 class="title">{% blocktrans %}Search Results for "{{ query }}"{% endblocktrans %}</h1>
|
2020-11-18 20:31:53 +00:00
|
|
|
</div>
|
|
|
|
|
2020-10-14 16:19:23 +00:00
|
|
|
<div class="block columns">
|
|
|
|
<div class="column">
|
2021-02-27 22:22:39 +00:00
|
|
|
<h2 class="title">{% trans "Matching Books" %}</h2>
|
2020-11-02 16:48:58 +00:00
|
|
|
<section class="block">
|
2020-11-02 17:03:48 +00:00
|
|
|
{% if not local_results.results %}
|
2021-02-27 22:22:39 +00:00
|
|
|
<p>{% blocktrans %}No books found for "{{ query }}"{% endblocktrans %}</p>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% else %}
|
2020-11-02 16:48:58 +00:00
|
|
|
<ul>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% for result in local_results.results %}
|
2020-11-02 16:48:58 +00:00
|
|
|
<li class="pd-4">
|
|
|
|
<a href="{{ result.key }}">{% include 'snippets/search_result_text.html' with result=result link=True %}</a>
|
|
|
|
</li>
|
2020-10-14 16:19:23 +00:00
|
|
|
{% endfor %}
|
2020-11-02 16:48:58 +00:00
|
|
|
</ul>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% endif %}
|
2020-10-14 16:19:23 +00:00
|
|
|
</section>
|
2020-11-02 16:48:58 +00:00
|
|
|
|
2021-02-04 19:46:42 +00:00
|
|
|
{% if request.user.is_authenticated %}
|
|
|
|
{% if book_results|slice:":1" and local_results.results %}
|
2020-11-02 16:48:58 +00:00
|
|
|
<div class="block">
|
|
|
|
<p>
|
2021-02-27 22:22:39 +00:00
|
|
|
{% trans "Didn't find what you were looking for?" %}
|
2020-11-02 16:48:58 +00:00
|
|
|
</p>
|
2021-03-01 01:10:30 +00:00
|
|
|
{% trans "Show results from other catalogues" as button_text %}
|
|
|
|
{% include 'snippets/toggle/open_button.html' with text=button_text small=True controls_text="more-results" %}
|
2020-11-02 16:48:58 +00:00
|
|
|
</div>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% endif %}
|
2020-11-02 16:48:58 +00:00
|
|
|
|
2021-01-17 16:26:28 +00:00
|
|
|
<div class="{% if local_results.results %}hidden{% endif %}" id="more-results">
|
2020-11-02 16:48:58 +00:00
|
|
|
{% 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">
|
2020-11-11 05:34:26 +00:00
|
|
|
<form action="/resolve-book" method="POST">
|
2020-11-02 16:48:58 +00:00
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="remote_id" value="{{ result.key }}">
|
|
|
|
<div>{% include 'snippets/search_result_text.html' with result=result link=False %}</div>
|
2021-02-27 22:22:39 +00:00
|
|
|
<button type="submit" class="button is-small is-link">{% trans "Import book" %}</button>
|
2020-11-02 16:48:58 +00:00
|
|
|
</form>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2021-01-17 16:26:28 +00:00
|
|
|
|
2020-11-02 17:03:48 +00:00
|
|
|
{% if local_results.results %}
|
2021-03-01 01:10:30 +00:00
|
|
|
{% trans "Hide results from other catalogues" as button_text %}
|
|
|
|
{% include 'snippets/toggle/close_button.html' with text=button_text small=True controls_text="more-results" %}
|
2020-11-02 17:03:48 +00:00
|
|
|
{% endif %}
|
2020-11-02 16:48:58 +00:00
|
|
|
</div>
|
2021-03-08 17:28:22 +00:00
|
|
|
|
|
|
|
<div class="block">
|
|
|
|
<a href="/create-book">Manually add book</a>
|
|
|
|
</div>
|
2021-02-04 19:46:42 +00:00
|
|
|
{% endif %}
|
2020-10-14 16:19:23 +00:00
|
|
|
</div>
|
|
|
|
<div class="column">
|
2021-02-01 19:50:47 +00:00
|
|
|
<section class="block">
|
2021-02-27 22:22:39 +00:00
|
|
|
<h2 class="title">{% trans "Matching Users" %}</h2>
|
2021-02-01 19:50:47 +00:00
|
|
|
{% if not user_results %}
|
2021-02-27 22:22:39 +00:00
|
|
|
<p>{% blocktrans %}No users found for "{{ query }}"{% endblocktrans %}</p>
|
2021-02-01 19:50:47 +00:00
|
|
|
{% endif %}
|
|
|
|
<ul>
|
|
|
|
{% for result in user_results %}
|
|
|
|
<li class="block">
|
2021-03-07 18:24:46 +00:00
|
|
|
<a href="{{ result.local_path }}">
|
|
|
|
{% include 'snippets/avatar.html' with user=result %}
|
|
|
|
{{ result.display_name }}
|
|
|
|
</a> ({{ result.username }})
|
2021-02-01 19:50:47 +00:00
|
|
|
{% include 'snippets/follow_button.html' with user=result %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
<section class="block">
|
2021-02-27 22:22:39 +00:00
|
|
|
<h2 class="title">{% trans "Lists" %}</h2>
|
2021-02-01 19:50:47 +00:00
|
|
|
{% if not list_results %}
|
2021-02-27 22:22:39 +00:00
|
|
|
<p>{% blocktrans %}No lists found for "{{ query }}"{% endblocktrans %}</p>
|
2021-02-01 19:50:47 +00:00
|
|
|
{% 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>
|
2020-10-14 16:19:23 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% endwith %}
|
2020-10-14 16:19:23 +00:00
|
|
|
{% endblock %}
|