{% load staticfiles mptt_tags menu_tags lang_tags %}
<header class="header_area">
    <div class="main_menu" id="mainNav">
        <nav class="mainmenu navbar navbar-expand-lg navbar-light">
            <div class="container">

                <a class="navbar-brand logo_h" href="/"><img src="{% static 'img/oms-cms2.svg' %}" alt=""></a>

                <button class="navbar-toggler" type="button" data-toggle="collapse"
                        data-target="#navbarSupportedContent"
                        aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>

                {% for_menu_item menu="Main" as items %}
                <div class="collapse navbar-collapse offset" id="navbarSupportedContent">
                    <ul>
                        {% recursetree items %}
                            <li>
                                {% if node.url %}
                                    <a class="" href="{{ node.url }}">{{ node.name }}</a>
                                {% elif node.anchor %}
                                    <a class="" href="{{ node.get_anchor }}">{{ node.name }}</a>
                                {% else %}
                                    <a class=""
                                       href="{{ node.content_object.get_absolute_url }}">{{ node.title }}</a>
                                {% endif %}
                                {% if not node.is_leaf_node %}
                                    <ul class="children">
                                        {{ children }}
                                    </ul>
                                {% endif %}
                            </li>
                        {% endrecursetree %}
                        {% for_list_lang as langs %}
                        {% for lang in langs %}
                            <li><a href="{% url 'languages:set_lang' %}?language={{ lang.slug }}">{{ lang.name }}</a></li>
                        {% endfor %}
                    </ul>
                </div>
            </div>
        </nav>
    </div>
</header>
