2020-10-14 16:19:23 +00:00
|
|
|
{% extends 'layout.html' %}
|
|
|
|
{% block content %}
|
2020-11-02 17:03:48 +00:00
|
|
|
{% with book_results|first as local_results %}
|
2020-10-14 16:19:23 +00:00
|
|
|
<div class="block columns">
|
|
|
|
<div class="column">
|
|
|
|
<h2 class="title">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 %}
|
|
|
|
<p>No books found for "{{ query }}"</p>
|
|
|
|
{% 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
|
|
|
|
2020-11-04 20:55:00 +00:00
|
|
|
{% if book_results|slice:":1" and local_results.results and request.user.is_authenticated %}
|
2020-11-02 16:48:58 +00:00
|
|
|
<div class="block">
|
|
|
|
<p>
|
|
|
|
Didn't find what you were looking for?
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<input class="toggle-control" type="radio" name="more-results" id="fewer-results" checked>
|
|
|
|
<div class="toggle-content hidden">
|
2020-11-10 02:57:56 +00:00
|
|
|
<label class="button is-small" for="more-results">
|
|
|
|
<div role="button" tabindex="0">Show results from other catalogues</div>
|
|
|
|
</label>
|
2020-11-02 16:48:58 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% endif %}
|
2020-11-02 16:48:58 +00:00
|
|
|
|
2020-11-02 17:03:48 +00:00
|
|
|
<input class="toggle-control" type="radio" name="more-results" id="more-results" {% if not local_results.results %}checked{% endif %}>
|
2020-11-02 16:48:58 +00:00
|
|
|
<div class="toggle-content hidden">
|
|
|
|
{% 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>
|
2020-11-06 23:20:11 +00:00
|
|
|
<button type="submit" class="button is-small is-link">Import book</button>
|
2020-11-02 16:48:58 +00:00
|
|
|
</form>
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2020-11-02 17:03:48 +00:00
|
|
|
{% if local_results.results %}
|
2020-11-10 02:57:56 +00:00
|
|
|
<label class="button is-small" for="fewer-results">
|
|
|
|
<div role="button" tabindex="0">Hide results from other catalogues</div>
|
|
|
|
</label>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% endif %}
|
2020-11-02 16:48:58 +00:00
|
|
|
</div>
|
2020-10-14 16:19:23 +00:00
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<h2 class="title">Matching Users</h2>
|
|
|
|
{% if not user_results %}
|
|
|
|
<p>No users found for "{{ query }}"</p>
|
|
|
|
{% endif %}
|
|
|
|
{% for result in user_results %}
|
|
|
|
<div 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 %}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-02 17:03:48 +00:00
|
|
|
{% endwith %}
|
2020-10-14 16:19:23 +00:00
|
|
|
{% endblock %}
|