Add breadcrumbs to search results
This commit is contained in:
parent
b13fe49664
commit
3c66267b79
4 changed files with 10 additions and 3 deletions
|
@ -42,6 +42,10 @@
|
|||
.columns {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
nav.breadcrumb {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.page-blogpostlistpage {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% load wagtailcore_tags cache util_tags %}
|
||||
|
||||
{% cache FRAGMENT_CACHE_TTL|jitter:FRAGMENT_CACHE_TTL_JITTER "listing-item" page.id request.is_preview %}
|
||||
{% cache FRAGMENT_CACHE_TTL|jitter:FRAGMENT_CACHE_TTL_JITTER "listing-item" page.id request.is_preview breadcrumbs %}
|
||||
<article class="media listing-item">
|
||||
<div class="columns">
|
||||
<figure class="media-left column is-3 image-column">
|
||||
|
@ -12,6 +12,9 @@
|
|||
</figure>
|
||||
<div class="media-content column">
|
||||
<div>
|
||||
{% if breadcrumbs %}
|
||||
{% include "common/breadcrumbs.html" with parents=page.get_parent_pages %}
|
||||
{% endif %}
|
||||
<h2 class="title is-3">
|
||||
<a href="{% pageurl page %}">{{ page.title }}</a>
|
||||
</h2>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% load wagtailadmin_tags %}
|
||||
|
||||
{% for page in results %}
|
||||
{% include "common/listing-item.html" %}
|
||||
{% include "common/listing-item.html" with breadcrumbs=True %}
|
||||
{% endfor %}
|
||||
|
||||
{% if not results and page_num == 1 %}
|
||||
|
|
|
@ -55,7 +55,7 @@ class SearchPageResultsTestCase(TestCase):
|
|||
cls.url = cls.page.url + cls.page.reverse_subpage("results")
|
||||
|
||||
def test_returns_results(self) -> None:
|
||||
with self.assertNumQueries(12):
|
||||
with self.assertNumQueries(24):
|
||||
response = self.client.get(self.url, {"q": "post"}, HTTP_HX_REQUEST="true")
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
|
Loading…
Reference in a new issue