diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_browse_results.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_browse_results.html new file mode 100644 index 000000000..2f8640abb --- /dev/null +++ b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_browse_results.html @@ -0,0 +1,12 @@ +{% load i18n %} + +{% if page_types_restricted %} + {% include "wagtailadmin/chooser/_page_type_restricted_warning.html" with page_type_name=page_type.get_verbose_name %} +{% endif %} + +

{% trans "Explorer" %}

+{% include "wagtailadmin/shared/breadcrumb.html" with page=parent_page choosing=1 %} + +{% if pages %} + {% include "wagtailadmin/pages/list.html" with choosing=1 allow_navigation=1 orderable=0 pages=pages parent_page=parent_page %} +{% endif %} diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_page_type_restricted_warning.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_page_type_restricted_warning.html new file mode 100644 index 000000000..949db9551 --- /dev/null +++ b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_page_type_restricted_warning.html @@ -0,0 +1,7 @@ +{% load i18n %} + +

+ {% blocktrans with type=page_type_name %} + Only pages of type "{{ type }}" may be chosen for this field. Search results will exclude pages of other types. + {% endblocktrans %} +

diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html index 62f911bf0..ad0ffdaba 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html @@ -1,30 +1,17 @@ {% load i18n %} {% if page_types_restricted %} -

- {% blocktrans with type=page_type.get_verbose_name %} - Only pages of type "{{ type }}" may be chosen for this field. Search results will exclude pages of other types. - {% endblocktrans %} -

+ {% include "wagtailadmin/chooser/_page_type_restricted_warning.html" with page_type_name=page_type.get_verbose_name %} {% endif %} -{% if not is_searching %} -

{% trans "Explorer" %}

- {% include "wagtailadmin/shared/breadcrumb.html" with page=parent_page choosing=1 %} -{% else %} -

- {% blocktrans count counter=pages|length %} - There is one match - {% plural %} - There are {{ counter }} matches - {% endblocktrans %} -

-{% endif %} +

+ {% blocktrans count counter=pages|length %} + There is one match + {% plural %} + There are {{ counter }} matches + {% endblocktrans %} +

{% if pages %} - {% if is_searching %} - {% include "wagtailadmin/pages/list.html" with choosing=1 show_parent=1 pages=pages parent_page=parent_page %} - {% else %} - {% include "wagtailadmin/pages/list.html" with choosing=1 allow_navigation=1 orderable=0 pages=pages parent_page=parent_page %} - {% endif %} -{% endif %} \ No newline at end of file + {% include "wagtailadmin/pages/list.html" with choosing=1 show_parent=1 pages=pages parent_page=parent_page %} +{% endif %} diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html index 98f758204..c5e1e1a78 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html @@ -1,9 +1,9 @@ {% load i18n %} {% if page_types_restricted %} - {% trans "Choose" as choose_str %} - {% trans page_type.get_verbose_name as subtitle %} + {% trans "Choose" as choose_str %} + {% trans page_type.get_verbose_name as subtitle %} {% else %} - {% trans "Choose a page" as choose_str %} + {% trans "Choose a page" as choose_str %} {% endif %} {% include "wagtailadmin/shared/header.html" with title=choose_str subtitle=subtitle search_url="wagtailadmin_choose_page" query_parameters="page_type="|add:page_type_string icon="doc-empty-inverse" %} @@ -12,6 +12,6 @@ {% include 'wagtailadmin/chooser/_link_types.html' with current='internal' %}
- {% include 'wagtailadmin/chooser/_search_results.html' %} + {% include 'wagtailadmin/chooser/_browse_results.html' %}
diff --git a/wagtail/wagtailadmin/views/chooser.py b/wagtail/wagtailadmin/views/chooser.py index da288b9dd..a177daddf 100644 --- a/wagtail/wagtailadmin/views/chooser.py +++ b/wagtail/wagtailadmin/views/chooser.py @@ -66,7 +66,6 @@ def browse(request, parent_page_id=None): 'querystring': get_querystring(request), 'searchform': search_form, 'pages': shown_pages, - 'is_searching': is_searching, 'page_type_string': page_type, 'page_type': desired_class, 'page_types_restricted': page_types_restricted @@ -79,7 +78,6 @@ def browse(request, parent_page_id=None): 'parent_page': parent_page, 'pages': shown_pages, 'search_form': search_form, - 'is_searching': False, 'page_type_string': page_type, 'page_type': desired_class, 'page_types_restricted': page_types_restricted