Template-Quelle: core/base/shopheader.html

{% extends "core/base/shopheader.html" %}

{% load i18n l10n cache canonical_tags eshop_tags sniplates %}
{% get_current_language as LANGUAGE_CODE %}

{# MOBILE HEADER #}

{% block shopheader-mobile-logo %}
    <div class="shopheader-mobile__logo">
        <a href="{% url "cms-page-index" %}" class="shopheader-mobile__logo-link">
            <img src="{% static "images/logo.svg" %}" class="shopheader-mobile__logo-img">
        </a>
    </div>
{% endblock %}

{% block hamburger-navigation-catalog %}
    {% if perms.catalog.view_node %}
        {% cache CACHE_TIMEOUTS.catalog_navigation mobile_catalog_nav request.user.pk LANGUAGE_CODE %}
            {% for node in catalog %}
                {% include "core/base/hamburger_catalog.html" with node=node %}
            {% endfor %}
            {% for node in reseller_product_groups %}
                {% include "core/base/hamburger_catalog.html" with node=node %}
            {% endfor %}
        {% endcache %}
    {% endif %}
{% endblock %}


{# HEADER #}

{% block shopheader-class %}{{ block.super }} sticky{% endblock %}

{% block shopheader-top-left %} {% endblock %}

{% block shopheader-top-right %}
    <div class="shopheader__meta-nav cell auto">
        {% block shopheader-meta-navigation %}
            {% cache CACHE_TIMEOUTS.cms_navigation desktop_cms_meta_nav site.settings.cms_domain request.user.is_anonymous LANGUAGE_CODE %}
                {% for page in cms_navigation.meta.get_navigable_children %}
                    {% if page.url %}
                        <a href="{{ page.get_absolute_url }}" target="{{ page.target }}">{{ page.title }}</a>
                    {% else %}
                        <span>{{ page.title }}</span>
                    {% endif %}
                {% endfor %}
            {% endcache %}
        {% endblock %}
        {% get_alternate_urls object True as alternates %}
        {% if alternates %}
            <div class="shopheader__language" data-toggle="language-menu">
                {{ LANGUAGE_CODE|language_name_translated }}
            </div>
            <div class="shopheader-menu shopheader-menu--languages dropdown-pane widget"
                 id="language-menu"
                 data-dropdown
                 data-close-on-click="true"
                 data-hover="false"
                 data-hover-pane="true"
                 data-position="bottom"
                 data-alignment="right">
                <div class="widget__content padding-2">
                    {% for lang_code, href in alternates %}
                        {% get_language_info for lang_code as language %}
                        <a href="{{ href }}"
                           class="shopheader__subnav__link text-left{% if lang_code == LANGUAGE_CODE %} font-bold{% endif %}"
                           data-lang-link>
                            {{ language.name_local|title }}
                        </a>
                    {% endfor %}
                </div>
            </div>
        {% endif %}
    </div>
{% endblock %}

{% block shopheader-bottom %}
    <nav class="shopheader__bottom">
        {% if perms.catalog.view_node %}
            <div class="container">
                <div class="shopheader__bottom__cell">
                    {% cache CACHE_TIMEOUTS.catalog_navigation desktop_catalog_nav request.user.pk LANGUAGE_CODE %}
                        {% with catalog|length as catalog_count %}
                            {% for node in catalog %}
                                {% if not node.custom_fields.hidden %}
                                    <a href="{{ node.get_absolute_url }}"
                                       data-toggle="subnav-catalog-{{ node.pk|unlocalize }}"
                                       class="shopheader__link shopheader__link--{% if catalog_count > 9 %}9{% else %}{{ catalog_count }}{% endif %}"
                                    >
                                        {{ node.label }}
                                    </a>
                                    <div
                                            id="subnav-catalog-{{ node.pk|unlocalize }}"
                                            class="shopheader__subnav shopheader__subnav--nested dropdown-pane catalog-menu"
                                            data-dropdown
                                            data-hover-delay="300"
                                            data-hover="true"
                                            data-hover-pane="true"
                                            data-close-on-click="true"
                                    >
                                        <div class="container grid-container padding-top-1">
                                            <div class="grid-x grid-padding-x tablet-up-3 laptop-up-4 desktop-up-5">
                                                {% for child_node in node.get_children %}
                                                    {% if not child_node.custom_fields.hidden %}
                                                        <div class="cell shopheader__subnav__cell">
                                                            <a href="{{ child_node.get_absolute_url }}"
                                                               class="shopheader__subnav__image">
                                                                {% with child_node.primary_image as image %}
                                                                    {% if image %}
                                                                        <img
                                                                                alt="{{ child_node.label }}"
                                                                                src="{% thumbor_url image.image_url width=240 height=160 fit_in=True trim=True %}"
                                                                        >
                                                                    {% endif %}
                                                                {% endwith %}
                                                            </a>
                                                            <a href="{{ child_node.get_absolute_url }}"
                                                               class="shopheader__subnav__title"
                                                            >
                                                                {{ child_node.label }}
                                                            </a>
                                                            {% for tree_leaf in child_node.get_children|slice:"5" %}
                                                                {% if not tree_leaf.custom_fields.hidden %}
                                                                    <a href="{{ tree_leaf.get_absolute_url }}"
                                                                       class="shopheader__subnav__link"
                                                                    >
                                                                        {{ tree_leaf.label }}
                                                                    </a>
                                                                {% endif %}
                                                            {% endfor %}
                                                            {% if child_node.get_children|length > 5 %}
                                                                <a class="shopheader__subnav__link"
                                                                   href="{{ child_node.get_absolute_url }}"
                                                                >
                                                                    <i class="icon icon-chevron-right"></i>
                                                                    <span>{{ _("mehr") }}</span>
                                                                </a>
                                                            {% endif %}
                                                        </div>
                                                    {% endif %}
                                                {% endfor %}
                                            </div>
                                        </div>
                                    </div>
                                {% endif %}
                            {% endfor %}
                        {% endwith %}
                    {% endcache %}
                    {% cache CACHE_TIMEOUTS.cms_navigation desktop_cms_special_nav site.settings.cms_domain request.user.is_anonymous LANGUAGE_CODE %}
                        {% for lookup_page in cms_navigation.root.get_navigable_children %}
                            {% if lookup_page.attributes.is_brand_world %}
                                <a href="{{ lookup_page.get_absolute_url }}"
                                   data-toggle="subnav-catalog-{{ lookup_page.pk|unlocalize }}"
                                   class="shopheader__link"
                                >
                                    {{ lookup_page.title }}
                                </a>
                                <div
                                    id="subnav-catalog-{{ lookup_page.pk|unlocalize }}"
                                    class="shopheader__subnav shopheader__subnav--discover dropdown-pane shopheader__subnav--nested"
                                    data-dropdown
                                    data-hover-delay="10"
                                    data-hover="true"
                                    data-hover-pane="true"
                                    data-close-on-click="true"
                                >
                                    <div class="container">
                                        {% cache CACHE_TIMEOUTS.cms_navigation desktop_cms_nested_special_nav site.settings.cms_domain request.user.is_anonymous LANGUAGE_CODE %}
                                            {% for page in lookup_page.get_navigable_children %}
                                                <div class="row">
                                                    {% if page.url %}
                                                        <a class="shopheader__subnav__title separator-left"
                                                           href="{{ page.get_absolute_url }}"
                                                           target="{{ page.target }}">{{ page.title }}</a>
                                                    {% else %}
                                                        <span class="shopheader__subnav__title separator-left">{{ page.title }}</span>
                                                    {% endif %}
                                                    <div class="grid-x grid-margin-x grid-margin-y small-up-2 tablet-up-3 laptop-up-4">
                                                        {% for subpage in page.get_navigable_children %}
                                                            <div class="cell">
                                                                {% if subpage.url %}
                                                                    <a class="shopheader__subnav__link font-bold"
                                                                       href="{{ subpage.get_absolute_url }}"
                                                                       target="{{ subpage.target }}">{{ subpage.title }}</a>
                                                                {% else %}
                                                                    <span class="shopheader__subnav__link font-bold">{{ subpage.title }}</span>
                                                                {% endif %}
                                                                {% for subsubpage in subpage.get_navigable_children %}
                                                                    {% if subsubpage.url %}
                                                                        <a class="shopheader__subnav__link"
                                                                           href="{{ subsubpage.get_absolute_url }}"
                                                                           target="{{ subsubpage.target }}">{{ subsubpage.title }}</a>
                                                                    {% else %}
                                                                        <span class="shopheader__subnav__link">{{ subsubpage.title }}</span>
                                                                    {% endif %}
                                                                {% endfor %}
                                                            </div>
                                                        {% endfor %}
                                                    </div>
                                                </div>
                                            {% endfor %}
                                        {% endcache %}
                                    </div>
                                </div>
                            {% endif %}
                        {% endfor %}
                    {% endcache %}
                </div>
                <div class="shopheader__bottom__cell shopheader__bottom__cell--right">
                    <button type="button" data-toggle="discover-menu" class="shopheader__link shopheader__link--more">
                        <span>{{ _("Unternehmen") }}<i class="icon"></i></span>
                    </button>
                    <div class="cell shrink">
                        <div
                                id="discover-menu"
                                class="shopheader__subnav shopheader__subnav--discover dropdown-pane shopheader__subnav--nested"
                                data-dropdown
                                data-hover="false"
                                data-hover-pane="true"
                                data-close-on-click="true"
                        >
                            <div class="container">
                                {% cache CACHE_TIMEOUTS.cms_navigation desktop_cms_nav site.settings.cms_domain request.user.is_anonymous LANGUAGE_CODE %}
                                    {% for page in cms_navigation.root.get_navigable_children %}
                                        {% if not page.attributes.is_brand_world %}
                                            <div class="row">
                                                {% if page.url %}
                                                    <a class="shopheader__subnav__title separator-left"
                                                       href="{{ page.get_absolute_url }}"
                                                       target="{{ page.target }}">{{ page.title }}</a>
                                                {% else %}
                                                    <span class="shopheader__subnav__title separator-left">{{ page.title }}</span>
                                                {% endif %}
                                                <div class="grid-x grid-margin-x grid-margin-y small-up-2 tablet-up-3 laptop-up-4">
                                                    {% for subpage in page.get_navigable_children %}
                                                        <div class="cell">
                                                            {% if subpage.url %}
                                                                <a class="shopheader__subnav__link font-bold"
                                                                   href="{{ subpage.get_absolute_url }}"
                                                                   target="{{ subpage.target }}">{{ subpage.title }}</a>
                                                            {% else %}
                                                                <span class="shopheader__subnav__link font-bold">{{ subpage.title }}</span>
                                                            {% endif %}
                                                            {% for subsubpage in subpage.get_navigable_children %}
                                                                {% if subsubpage.url %}
                                                                    <a class="shopheader__subnav__link"
                                                                       href="{{ subsubpage.get_absolute_url }}"
                                                                       target="{{ subsubpage.target }}">{{ subsubpage.title }}</a>
                                                                {% else %}
                                                                    <span class="shopheader__subnav__link">{{ subsubpage.title }}</span>
                                                                {% endif %}
                                                            {% endfor %}
                                                        </div>
                                                    {% endfor %}
                                                </div>
                                            </div>
                                        {% endif %}
                                    {% endfor %}
                                {% endcache %}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        {% endif %}
    </nav>
{% endblock %}

{% block shopheader-account %}
    {% load_widgets navigation="core/widgets/navigation.html" %}
    <section class="shopheader__account">
        {% if user.is_authenticated %}
            {% block admin-navigation %}{{ block.super }}{% endblock %}
        {% else %}
            <a href="{% url "login" %}?next={{ request.GET.next|default:request.get_full_path|urlencode:"" }}"
               title="{{ _("Login") }}">
                <i class="icon icon-login medium secondary"></i> &nbsp;{{ _("Login") }}
            </a>
        {% endif %}
        {% if perms.containers.use_cart %}
            <a href="{% url "cart-detail" %}" title="{{ _("Warenkorb") }}" data-toggle="cart-menu">
                <i class="icon icon-cart medium"></i>
                <span class="badge {% if not cart_position_count %}hide{% endif %}" data-bind-text="cart:positionCount"
                      data-bind-class="cart:isEmpty,hide">
                    {{ cart_position_count }}
                </span>
            </a>
            <div
                    class="shopheader-menu shopheader-menu--cart dropdown-pane widget {% if not cart_position_count %}hide{% endif %}"
                    data-bind-class="cart:isEmpty,hide"
                    data-bind-prop-set="cart:hasPositions,data-cart-preview={% url "cart-preview" %}"
                    {% if cart_position_count %}data-cart-preview={% url "cart-preview" %}{% endif %}
                            id="cart-menu"
                    data-dropdown
                    data-hover="true"
                    data-hover-pane="true"
                    data-position="bottom"
                    data-alignment="right"
            >
                <div class="cart-preview" data-cart-preview-widget>
                    <div class="cart-preview__loader"><i class="icon loader"></i></div>
                    <div
                            class="cart-preview__content"
                            data-bind-innerhtml="cart:preview"
                    ></div>
                </div>
            </div>
        {% endif %}
    </section>
{% endblock %}