1
0
Fork 0

Fixes pagination of local search results

This commit is contained in:
Mouse Reeve 2022-08-04 11:42:03 -07:00
parent 3270d0a7d4
commit 06d1936ac9
3 changed files with 72 additions and 64 deletions

View file

@ -3,10 +3,9 @@
{% block panel %}
{% if results %}
{% with results|first as local_results %}
{% if results or remote_results %}
<ul class="block">
{% for result in local_results.results %}
{% for result in results %}
<li class="pd-4 mb-5 local-book-search-result" id="tour-local-book-search-result">
<div class="columns is-mobile is-gapless mb-0">
<div class="column is-cover">
@ -29,16 +28,12 @@
</li>
{% endfor %}
</ul>
{% endwith %}
<div class="block">
{% for result_set in results|slice:"1:" %}
{% for result_set in remote_results %}
{% if result_set.results %}
<section class="mb-5">
{% if not result_set.connector.local %}
<details class="details-panel box" open>
{% endif %}
{% if not result_set.connector.local %}
<summary class="is-flex is-align-items-center is-flex-wrap-wrap is-gap-2 remote-book-search-result" id="tour-remote-search-result">
<span class="mb-0 title is-5">
{% trans 'Results from' %}
@ -47,7 +42,6 @@
<span class="details-close icon icon-x" aria-hidden="true"></span>
</summary>
{% endif %}
<div class="mt-5">
<div class="is-flex is-flex-direction-row-reverse">
@ -88,17 +82,15 @@
</ul>
</div>
</div>
{% if not result_set.connector.local %}
</details>
{% endif %}
</section>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endblock %}
{% block search_footer %}
<p class="block">
{% if request.user.is_authenticated %}
{% if not remote %}

View file

@ -1,5 +1,6 @@
{% extends 'layout.html' %}
{% load i18n %}
{% load humanize %}
{% block title %}{% trans "Search" %}{% endblock %}
@ -53,17 +54,24 @@
</nav>
<section class="block" id="search-results-block">
{% if not results %}
<p>
<p class="block">
{% if not results %}
<em>{% blocktrans %}No results found for "{{ query }}"{% endblocktrans %}</em>
{% else %}
<em>{% blocktrans trimmed count counter=results.paginator.count with result_count=results.paginator.count|intcomma %}
{{ result_count }} result found
{% plural %}
{{ result_count }} results found
{% endblocktrans %}</em>
{% endif %}
</p>
{% endif %}
{% block panel %}
{% endblock %}
<div>
<div class="block">
{% include 'snippets/pagination.html' with page=results path=request.path %}
</div>
{% block search_footer %}{% endblock %}
</section>
{% endif %}