{#
    -*- coding: utf-8 -*-
    Copyright (C) 2019-2020 CERN.
    Copyright (C) 2019-2020 Northwestern University.

    Invenio App RDM is free software; you can redistribute it and/or modify it
    under the terms of the MIT License; see LICENSE file for more details.
#}



<header class="theme header">
  <div class="outer-navbar">
    {%- block navbar %}
    <nav id="invenio-nav" class="ui inverted menu borderless">
      <div class="ui grid container">
        {%- block navbar_header %}
        {%- block brand %}
          {%- if config.THEME_LOGO %}
          <a href="/">
            <img class="ui medium image rdm-logo"
                src="{{ url_for('static', filename=config.THEME_LOGO) }}"/>
          </a>
          {%- else %}
          <a class="logo" href="/">{{ _(config.THEME_SITENAME) }}</a>
          {%- endif %}
        {%- endblock brand %}
        {%- endblock navbar_header %}

        {%- block navbar_inner %}

        {%- block navbar_nav %}
          {%- if config.THEME_SEARCHBAR %}
            {%- block navbar_search %}
              <div class="item" id="header-search-bar">
                <form class="form" action="{{ config.THEME_SEARCH_ENDPOINT }}" role="search">
                  <div class="ui action icon input">
                    <input type="text" name="q" placeholder="{{ _('Search') }}">
                    <button type="submit" class="ui icon search button">
                      <i class="icon search"></i>
                    </button>
                  </div>
                </form>
              </div>

            {%- endblock navbar_search %}
          {%- endif %}

          <ul class="no-dots-list">
            {%- for item in current_menu.submenu('main').children|sort(attribute='order') if item.visible recursive %}
              <div class="item navbar-options">
                {%- if item.children %}
                <div class="dropdown{{ ' active' if item.active else '' }}">
                  <a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                    aria-expanded="false" href="{{ item.url }}">{{ item.text|safe }} <b class="caret"></b></a>
                  <ul class="dropdown-menu">{{ loop(item.children|sort(attribute='order')) }}</ul>
                </div>
                {%- else %}
                <li{{ ' class="active"'|safe if item.active and loop.depth == 1 else '' }}>
                  <a href="{{ item.url }}">{{ item.text|safe }}</a></li>
                  {%- endif %}
              </div>
            {%- endfor %}
          </ul>
        {%- endblock navbar_nav %}

          <div class="right menu">
            <ul class="no-dots-list">
              <div class="item right-menu">
        {%- block navbar_right %}
          <li>{%- include config.THEME_HEADER_LOGIN_TEMPLATE %}</li>
        {%- endblock navbar_right %}
                </div>
              {%- endblock navbar_inner %}
              </ul>
            </div>
          </div>
        </nav>
      {%- endblock navbar %}
  </div>
  {%- block flashmessages %}
  {%- from "invenio_theme/macros/messages.html" import flashed_messages with context -%}
  {{ flashed_messages() }}
  {%- endblock %}
  {%- block breadcrumbs %}
  {%- include "invenio_theme/breadcrumbs.html" %}
  {%- endblock breadcrumbs %}
</header>
