Move "page type restricted" warning out of the page-results container

This means we don't have to duplicate it in the search results output.
This commit is contained in:
Matt Westcott 2015-06-25 17:25:29 +01:00
parent d7843f34e3
commit 5dc2308a98
5 changed files with 10 additions and 19 deletions

View file

@ -1,9 +1,5 @@
{% 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 %}

View file

@ -1,7 +0,0 @@
{% 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>

View file

@ -1,9 +1,5 @@
{% 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>
{% blocktrans count counter=pages|length %}
There is one match

View file

@ -1,7 +1,7 @@
{% load i18n %}
{% if page_types_restricted %}
{% trans "Choose" as choose_str %}
{% trans page_type.get_verbose_name as subtitle %}
{% trans page_type_name as subtitle %}
{% else %}
{% trans "Choose a page" as choose_str %}
{% endif %}
@ -11,6 +11,14 @@
<div class="nice-padding">
{% include 'wagtailadmin/chooser/_link_types.html' with current='internal' %}
{% if page_types_restricted %}
<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>
{% endif %}
<div class="page-results">
{% include 'wagtailadmin/chooser/_browse_results.html' %}
</div>

View file

@ -57,7 +57,7 @@ def browse(request, parent_page_id=None):
'pages': shown_pages,
'search_form': search_form,
'page_type_string': page_type,
'page_type': desired_class,
'page_type_name': desired_class.get_verbose_name(),
'page_types_restricted': (page_type != 'wagtailcore.page')
})
@ -89,8 +89,6 @@ def search(request, parent_page_id=None):
'querystring': get_querystring(request),
'searchform': search_form,
'pages': shown_pages,
'page_type': desired_class,
'page_types_restricted': (page_type != 'wagtailcore.page')
})