view MoinMoin/templates/search.html @ 1988:490c13d072f2

remove Submit widget The Submit widget was a mistake. The buttons carry no user input, and making it part of the form screws up POST form handling. Instead of being a widget, the submit button has its label kept in the class member submit_label of the Form, and is rendered by a new macro forms.render_submit.
author Cheer Xiao <xiaqqaix@gmail.com>
date Tue, 12 Feb 2013 10:28:18 +0800
parents 2bd864ed640e
children e9d25b2c89a6
line wrap: on
line source
{% extends theme("layout.html") %}
{% import "forms.html" as forms %}
{% import "utils.html" as utils %}

{% set search_form = None %} {# layout will not show search form in header #}

{% block pagepath %}
    {{ _("Search") }}
    {{ super() }}
{% endblock %}

{% block content %}
    {% if results is defined %}
    <p class="searchstats">
        {% if results %}
        {{ _("%(result_len)d results found (%(runtime).3f secs).",
              result_len=results|length, runtime=results.runtime
            )
        }}
        {% else %}
        {{ _("No results found (%(runtime).3f secs).", runtime=results.runtime) }}
        {% endif %}
    </p>
    {% endif %}
    {{ gen.form.open(medium_search_form, id='moin-long-searchform', method='get', action=url_for('frontend.search', item_name=item_name)) }}
        <p>
        {{ forms.render(medium_search_form['q']) }}
        {{ forms.render_submit(medium_search_form) }}
        </p>
        <p>
        {{ forms.render(medium_search_form['history']) }}
        {{ forms.render_errors(medium_search_form) }}
        </p>
    {{ gen.form.close() }}
    {% if results is defined %}
        {% if name_suggestions or content_suggestions %}
            <p>{{ _("name term suggestions: %(termlist)s", termlist=name_suggestions) }}</p>
            <p>{{ _("content term suggestions: %(termlist)s", termlist=content_suggestions) }}</p>
        {% endif %}
        {% if results %}
            <div class="searchresults">
                <table>
                    {% for result in results %}
                        {% if result['wikiname'] == cfg.interwikiname %}
                            <tr>
                                <td class="moin-wordbreak">{{ result.pos + 1 }}
                                <a href="{{ url_for_item(item_name=result['name'][0], wiki_name='Self', rev=result['revid']) }}"><b>{{ result['name'] | join(' | ')}}</b></a>
                                </td>
                            </tr>
                            {% if result['summary'] %}
                                <tr>
                                    <td>
                                        <p class="info searchhitinfobar">{{ _("Summary: %(summary)s", summary=result['summary']) }}</p>
                                    </td>
                                </tr>
                            {% endif %}
                            <tr>
                                <td>
                                    <p class="info searchhitinfobar">{{ _("Revision: %(revid)s Last Change: %(mtime)s", revid=result['revid'], mtime=result['mtime']|datetimeformat) }}</p>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    {% if user.may.read(result['name']) %}
                                        <p class="info foundtext">{{ result.highlights('content')|safe }}</p>
                                    {% else %}
                                        <p class="info foundtext">{{ _("You don't have read permission for this item.") }}</p>
                                    {% endif %}
                                </td>
                            </tr>
                        {% else %}
                            <tr>
                                <td class="moin-wordbreak">{{ result.pos + 1 }}
                                <a class="moin-interwiki" href="{{ url_for_item(item_name=result['name'], wiki_name=result['wikiname'], rev=result['revid']) }}"><b>{{ "%s:%s" % (result['wikiname'], result['name']) }}</b></a>
                                </td>
                            </tr>
                        {% endif %}
                    {% endfor %}
                </table>
            </div>
        {% endif %}
    {% endif %}
{% endblock %}