{% load i18n cms_tags %}

<div class="content__frame">
    {% url 'search' as search_url %}
    {% with request.get_full_path as current_url %}
        <a href="{% if search_url in current_url %}/{{ LANGUAGE_CODE }}/{% else %}{{ current_url }}{% endif %}"
           class="search__close header__button header__button--close">
            <span class="header__button__icon">
                {% include 'project/assets/close.svg' %}
            </span>
            {% trans 'Schliessen' %}
        </a>
    {% endwith %}
    <div class="content__container">
        <div class="content__main">
            <div class="search__content">
                <div class="search__content__main">
                    <form action="{% url 'search' %}" method="get" class="search__form">
                        <input id="search__query" type="text" name="{{ search_form.q.html_name }}"
                               placeholder="{% trans 'Elementa entdecken...' %}" autocomplete="off"
                               {% if search_form.q.value %}value="{{ search_form.q.value }}"{% endif %}>
                        <button type="submit">
                            {% include 'project/assets/search.svg' %}
                            {% trans 'Suchen' %}
                        </button>
                    </form>

                    <div class="search__results">
                        <p class="section__text search__results__amount">
                            {% if page_obj.object_list|length > 0 %}
                                {% blocktrans with amount=page_obj.object_list|length q=search_form.q.value %}
                                    {{ amount }} Resultate für «{{ q }}»:
                                {% endblocktrans %}
                            {% else %}
                                <strong>
                                    {% blocktrans with q=search_form.q.value %}
                                        Leider wurden keine Resultate mit dem Begriff «{{ q }}» gefunden.<br>
                                        Sie erreichen uns auch über andere Kanäle:
                                    {% endblocktrans %}
                                    <a href="{% page_url 'contact' %}">{% trans 'Zum Kontakt' %}</a>
                                </strong>
                            {% endif %}
                        </p>
                        <ul>
                            {% for page in page_obj.object_list %}
                                {% include "project/includes/page_item.html" with search=True image=page.object.page.imageextension.image cropping=page.object.page.imageextension.cropping %}
                            {% endfor %}
                        </ul>
                        {#                    {% include "project/includes/pagination.html" with obj_string=_('results') %}#}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>