mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-26 15:44:01 +00:00
Split 'browse' and 'search' views of the page chooser into separate templates
instead of one template full of is_searching switches
This commit is contained in:
parent
9a4c823854
commit
257848d58a
5 changed files with 33 additions and 29 deletions
|
|
@ -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 %}
|
||||
|
||||
<h2>{% trans "Explorer" %}</h2>
|
||||
{% 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 %}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
{% load i18n %}
|
||||
|
||||
<p class="help-block help-warning">
|
||||
{% 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 %}
|
||||
</p>
|
||||
|
|
@ -1,30 +1,17 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% if page_types_restricted %}
|
||||
<p class="help-block help-warning">
|
||||
{% 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 %}
|
||||
</p>
|
||||
{% include "wagtailadmin/chooser/_page_type_restricted_warning.html" with page_type_name=page_type.get_verbose_name %}
|
||||
{% endif %}
|
||||
|
||||
{% if not is_searching %}
|
||||
<h2>{% trans "Explorer" %}</h2>
|
||||
{% include "wagtailadmin/shared/breadcrumb.html" with page=parent_page choosing=1 %}
|
||||
{% else %}
|
||||
<h2>
|
||||
{% blocktrans count counter=pages|length %}
|
||||
There is one match
|
||||
{% plural %}
|
||||
There are {{ counter }} matches
|
||||
{% endblocktrans %}
|
||||
</h2>
|
||||
{% endif %}
|
||||
<h2>
|
||||
{% blocktrans count counter=pages|length %}
|
||||
There is one match
|
||||
{% plural %}
|
||||
There are {{ counter }} matches
|
||||
{% endblocktrans %}
|
||||
</h2>
|
||||
|
||||
{% 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 %}
|
||||
{% include "wagtailadmin/pages/list.html" with choosing=1 show_parent=1 pages=pages parent_page=parent_page %}
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -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' %}
|
||||
|
||||
<div class="page-results">
|
||||
{% include 'wagtailadmin/chooser/_search_results.html' %}
|
||||
{% include 'wagtailadmin/chooser/_browse_results.html' %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue