diff --git a/wagtail/wagtailadmin/forms.py b/wagtail/wagtailadmin/forms.py
index 84f4426c4..ca70c654e 100644
--- a/wagtail/wagtailadmin/forms.py
+++ b/wagtail/wagtailadmin/forms.py
@@ -28,15 +28,11 @@ class URLOrAbsolutePathField(forms.URLField):
value = super(URLOrAbsolutePathField, self).to_python(value)
return value
+
class SearchForm(forms.Form):
def __init__(self, *args, **kwargs):
- _placeholder = kwargs.pop('placeholder', None)
- placeholder_suffix = kwargs.pop('placeholder_suffix', "")
+ placeholder = kwargs.pop('placeholder', _("Search"))
super(SearchForm, self).__init__(*args, **kwargs)
- if _placeholder is not None:
- placeholder = _placeholder
- else:
- placeholder = 'Search {0}'.format(placeholder_suffix)
self.fields['q'].widget.attrs = {'placeholder': placeholder}
q = forms.CharField(label=_("Search term"), widget=forms.TextInput())
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_form.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_form.html
deleted file mode 100644
index 1cd683f91..000000000
--- a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_form.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{% load i18n %}
-
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/templates/wagtailadmin/chooser/search.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/search.html
deleted file mode 100644
index e51179170..000000000
--- a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/search.html
+++ /dev/null
@@ -1,13 +0,0 @@
-{% load i18n %}
-{% trans "Choose a page" as choose_str %}
-{% include "wagtailadmin/shared/header.html" with title=choose_str %}
-
-
- {% include 'wagtailadmin/chooser/_link_types.html' with current='internal' %}
-
- {% include 'wagtailadmin/chooser/_search_form.html' %}
-
-
{# content in here will be replaced by live search results #}
- {% include 'wagtailadmin/chooser/_search_results.html' %}
-
-
diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/search.js b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/search.js
deleted file mode 100644
index d8ba5d70b..000000000
--- a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/search.js
+++ /dev/null
@@ -1,9 +0,0 @@
-function(modal) {
- $('.link-types a', modal.body).click(function() {
- modal.loadUrl(this.href);
- return false;
- });
-
- {% include 'wagtailadmin/chooser/_search_behaviour.js' %}
- ajaxifySearchResults();
-}
diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html b/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html
index 6d394d499..3e6aa98b5 100644
--- a/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html
+++ b/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html
@@ -1,4 +1,22 @@
{% load i18n wagtailadmin_tags %}
+{% comment %}
+
+ Variables accepted by this template:
+
+ title
+ subtitle
+
+ search_url - if present, display a search box. This is a URL route name (taking no parameters) to be used as the action for that search box
+ query_parameters - a query string (without the '?') to be placed after the search URL
+
+ icon - name of an icon to place against the title
+
+ tabbed - if true, add the classname 'tab-merged'
+ merged - if true, add the classname 'merged'
+
+ add_link - if present, display an 'add' button. This is a URL route name (taking no parameters) to be used as the link URL for the button
+ add_text - text for the 'add' button
+{% endcomment %}