{% extends 'admin/base.html' %}
{% import 'shelf/static.html' as shelf_static with context %}
{% import 'shelf/lib.html' as lib with context %}

{% block head_css %}
    <link rel="stylesheet" type="text/css" media="screen" href="{{ shelf_static.url(filename='bootstrap3/css/bootstrap.min.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ shelf_static.url(filename='font-awesome/css/font-awesome.min.css') }}">
    <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:400,300,600">
    <link rel="stylesheet" type="text/css" href="{{ shelf_static.url(filename='shelf/css/shelf.css') }}">
    {{ lib.get_view_extensions("head_css") }}
{% endblock %}

{% block page_body %}
<div id="wrap">
  <div class="navbar navbar-default navbar-fixed-top">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".top-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">
          {% block brand %}
          <img style="height: 38px" src="{{ shelf_static.url(filename='shelf/img/shelf_logo.png') }}" />
          {% endblock %}
        </a>
      </div>
      <div class="collapse navbar-collapse top-collapse">
        {% block main_menu %}
        <ul class="nav navbar-nav">
          {{ layout.menu() }}
        </ul>
        {% endblock %}
        {#% block menu_links %}
        <ul class="nav navbar-nav navbar-right">
          {{ layout.menu_links() }}
          {% if user_panel is defined %}
            {{ user_panel|safe }}
          {% endif %}
        </ul>
        {% endblock %#}
        {% block access_control %}
            {% if current_user %}
                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="fa fa-user"></i>
                        </a>
                        <ul class="dropdown-menu">
                            <li class="dropdown-header">Hello, {{ current_user.email }}</li>
                            <li><a href="{{ url_for('user.edit_view', id=current_user.id, url=return_url) }}">My profile</a></li>
                            {% if security.changeable %}
                                <li><a href="{{ url_for_security('change_password', next=return_url) }}">Change password</a></li>
                            {% endif %}
                            <li><a href="{{ url_for_security('logout') }}">Log out</a></li>
                        </ul>
                    </li>
                </ul>
            {% endif %}
        {% endblock %}
      </div>
    </div>
  </div>

  {% block superbody %}
  <div class="container">
    {% block body %}{% endblock %}
  </div>
  {% endblock %}

  {% block messages %}
    {{ layout.messages() }}
  {% endblock %}

  {% set render_ctx = h.resolve_ctx() %}
</div>
{% endblock %}

{% block tail_js %}
    {{ super()|safe }}
    {{ lib.get_view_extensions("tail_js") }}
    <script language="javascript" src="{{ url_for('library.static', filename='jquery.file.js') }}"></script>
    <script language="javascript" src="{{ url_for('shelf.static', filename='humanize/humanize.js') }}"></script>
    <script language="javascript" src="{{ url_for('shelf.static', filename='jquery/jquery.observe.js') }}"></script>
{% endblock %}

{% block tail %}
{% endblock %}
