{% set templateTitle = 'Search results'|trans %}
{{ moduleHeader('user', templateTitle, true, true) }}

<h3>{{ templateTitle }}</h3>

{% if errors is not empty %}
    <div class="alert alert-danger">
    {% for error in errors %}
        <p>{{ error }}</p>
    {% endfor %}
    </div>
{% endif %}

<p>{% trans with { '%s': paginator.numResults } %}Number of hits: %s{% endtrans %}</p>

<dl class="search_results">
    {% for result in paginator.results %}
    <dt class="search_hit">
        {% if result.url|default %}
            <a href="{{ result.url|zikulasearchmodule_generateUrl|e('html_attr') }}">
        {% endif %}
        {{ result.title|zikulasearchmodule_highlightWords(q) }}
        {% if result.url|default %}
            </a>
        {% endif %}
    </dt>
    <dd>
        {{ result.text|default('')|u.truncate(limitSummary, '…')|zikulasearchmodule_highlightWords(q) }}
        {% if result.created is not empty %}
            <div class="search_created">{% trans with { '%s': result.created|format_date('long') } %}Created on %s.{% endtrans %}</div>
        {% endif %}
    </dd>
    {% endfor %}
</dl>
{{ include(paginator.template) }}
