mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-10 16:24:49 +00:00
Merge branch 'snippets-search' of https://github.com/kaedroho/wagtail into kaedroho-snippets-search
This commit is contained in:
commit
97febeb089
3 changed files with 8 additions and 6 deletions
|
|
@ -3,16 +3,18 @@
|
|||
{% include "wagtailadmin/shared/header.html" with title=choose_str subtitle=snippet_type_name icon="snippet" %}
|
||||
|
||||
<div class="nice-padding">
|
||||
{% if is_searchable %}
|
||||
<form class="snippet-search search-bar" action="{% url 'wagtailsnippets:choose' content_type.app_label content_type.model %}" method="GET">
|
||||
{# Need to keep the form in the HTML, even if the snippet is not searchable #}
|
||||
{# This is to allow pagination links to be generated from the form action URL #}
|
||||
<form class="snippet-search search-bar" action="{% url 'wagtailsnippets:choose' content_type.app_label content_type.model %}" method="GET">
|
||||
{% if is_searchable %}
|
||||
<ul class="fields">
|
||||
{% for field in search_form %}
|
||||
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}
|
||||
{% endfor %}
|
||||
<li class="submit"><input type="submit" value="{% trans 'Search' %}" /></li>
|
||||
</ul>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</form>
|
||||
|
||||
<div id="search-results" class="listing snippets">
|
||||
{% include "wagtailsnippets/chooser/results.html" with choosing=1 %}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ function initModal(modal) {
|
|||
function setPage(page) {
|
||||
var dataObj = {p: page, results: 'true'};
|
||||
|
||||
if ($('#id_q').val().length) {
|
||||
if ($('#id_q').length && $('#id_q').val().length) {
|
||||
dataObj.q = $('#id_q').val();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
{% if items %}
|
||||
{% if is_searching %}
|
||||
<h2>
|
||||
{% blocktrans count counter=items|length %}
|
||||
{% blocktrans count counter=items.paginator.count %}
|
||||
There is one match
|
||||
{% plural %}
|
||||
There are {{ counter }} matches
|
||||
|
|
|
|||
Loading…
Reference in a new issue