Skip to content

Commit

Permalink
[bug 758602] Add search field to bottom of results
Browse files Browse the repository at this point in the history
  • Loading branch information
rehandalal committed Jun 8, 2012
1 parent 91c8a08 commit ea80c1a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
17 changes: 17 additions & 0 deletions apps/search/templates/search/includes/macros.html
Expand Up @@ -4,3 +4,20 @@
{# Must be imported with context #}
<input type="hidden" name="e" value="{% if waffle.flag('elasticsearch') %}es{% else %}sph{% endif %}" />
{%- endmacro %}

{% macro basic_search_form(primary=False) -%}
{# Must be imported with context #}
<div {% if primary %}id="basic-search"{% endif %} class="search-refine">
<form role="search" method="get" action="search">
{{ search_engine() }}
{% for name, field in search_form.fields.items() if not name in ('q',) %}
{% set list = request.GET.getlist(name) %}
{% for value in list %}
<input type="hidden" name="{{ name }}" value="{{ value }}" />
{% endfor %}
{% endfor %}
<input type="text" class="search-query search-refine-query" value="{{ q }}" name="q">
<input type="submit" class="search-refine-submit btn-large" value="{{ _('Search') }}">
</form>
</div>
{%- endmacro %}
18 changes: 4 additions & 14 deletions apps/search/templates/search/results.html
@@ -1,25 +1,13 @@
{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "search/base.html" %}
{% from "search/includes/result.html" import search_result with context %}
{% from "search/includes/macros.html" import search_engine with context %}
{% from "search/includes/macros.html" import search_engine, basic_search_form with context %}
{% set meta = (('WT.oss', q),
('WT.oss_r', num_results)) %}

{% block content %}
<article id="search-results" class="main">
<div id="basic-search" class="search-refine">
<form role="search" method="get" action="search">
{{ search_engine() }}
{% for name, field in search_form.fields.items() if not name in ('q',) %}
{% set list = request.GET.getlist(name) %}
{% for value in list %}
<input type="hidden" name="{{ name }}" value="{{ value }}" />
{% endfor %}
{% endfor %}
<input type="text" class="search-query search-refine-query" value="{{ q }}" name="q">
<input type="submit" class="search-refine-submit btn-large" value="{{ _('Search') }}">
</form>
</div>
{{ basic_search_form(True) }}

<div class="search-count">
{# L10n: {n} is the number of search results, {q} is the search query, {l} is the language searched. #}
Expand All @@ -36,6 +24,8 @@

{{ pages|paginator }}

{{ basic_search_form() }}

</div>

{% if request.locale == settings.WIKI_DEFAULT_LANGUAGE %}
Expand Down

0 comments on commit ea80c1a

Please sign in to comment.