mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-29 01:22:07 +01:00
Reuse search_form block from slim_header in page_listing_header.html
And rename get_results_url() in pages' BaseIndexView to get_index_results_url to match the method in generic IndexView
This commit is contained in:
parent
28d21bf066
commit
174146edef
@ -4,7 +4,7 @@
|
||||
|
||||
{% block header %}
|
||||
{% page_permissions parent_page as parent_page_perms %}
|
||||
{% include 'wagtailadmin/pages/page_listing_header.html' with title=header_title page_perms=parent_page_perms %}
|
||||
{% include 'wagtailadmin/pages/page_listing_header.html' with title=header_title search_url=search_url page_perms=parent_page_perms %}
|
||||
{% endblock %}
|
||||
|
||||
{% block listing %}
|
||||
|
@ -20,43 +20,6 @@
|
||||
{% include "wagtailadmin/shared/page_status_tag_new.html" with page=parent_page %}
|
||||
{% endblock %}
|
||||
|
||||
{% block search_form %}
|
||||
<div>
|
||||
<div class="w-mx-2">
|
||||
<form
|
||||
class="search-form"
|
||||
action="{{ index_url }}"
|
||||
method="get"
|
||||
novalidate
|
||||
role="search"
|
||||
data-search-form
|
||||
data-controller="w-swap"
|
||||
data-action="change->w-swap#searchLazy input->w-swap#searchLazy"
|
||||
data-w-swap-src-value="{{ results_url }}"
|
||||
data-w-swap-target-value="#listing-results"
|
||||
>
|
||||
{% for field in search_form %}
|
||||
{% formattedfield field=field classname="w-mb-0 -w-mt-2.5" sr_only_label=True icon="search" %}
|
||||
{% endfor %}
|
||||
{% comment %}Add an initial disabled & hidden submit button so that pressing 'enter' will not submit form. Reload not required as the content is dynamically loaded.{% endcomment %}
|
||||
<div class="visuallyhidden"><input disabled type="submit" aria-hidden="true"/></div>
|
||||
<div class="submit visuallyhidden"><input type="submit" value="Search" class="button" /></div>
|
||||
|
||||
{% dialog_toggle classname='button button-small w-mt-4' dialog_id='filters-dialog' text='Show filters' %}
|
||||
{% dialog theme="floating" id="filters-dialog" title="Filters" dialog_root_selector="[data-search-form]" %}
|
||||
{% for field in filters.form %}
|
||||
{% formattedfield field %}
|
||||
{% endfor %}
|
||||
<button class="button" type="submit">
|
||||
{% trans 'Apply filters' %}
|
||||
</button>
|
||||
{% enddialog %}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block side_panels %}
|
||||
{% include "wagtailadmin/shared/side_panels.html" with in_explorer=True %}
|
||||
{% endblock side_panels %}
|
||||
|
@ -280,7 +280,7 @@ class BaseIndexView(generic.IndexView):
|
||||
def get_index_url(self):
|
||||
return reverse("wagtailadmin_explore", args=[self.parent_page.id])
|
||||
|
||||
def get_results_url(self):
|
||||
def get_index_results_url(self):
|
||||
return reverse("wagtailadmin_explore_results", args=[self.parent_page.id])
|
||||
|
||||
def get_history_url(self):
|
||||
@ -335,7 +335,7 @@ class BaseIndexView(generic.IndexView):
|
||||
"parent_page": self.parent_page,
|
||||
"ordering": self.ordering,
|
||||
"index_url": self.get_index_url(),
|
||||
"results_url": self.get_results_url(),
|
||||
"search_url": self.get_index_results_url(),
|
||||
"history_url": self.get_history_url(),
|
||||
"search_form": self.search_form,
|
||||
"is_searching": self.is_searching,
|
||||
|
Loading…
Reference in New Issue
Block a user