{% 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 href="{{ shelf_static.url(filename='bootstrap3/css/bootstrap.min.css') }}" rel="stylesheet" media="screen">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" integrity="sha384-XdYbMnZ/QjLh6iI4ogqCTaIjrFk87ip+ekIjefZch0Y+PvJ8CDYtEs1ipDmPorQ+" crossorigin="anonymous">
    <link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
    <link href="{{ shelf_static.url(filename='shelf/css/shelf.css') }}" rel="stylesheet">
    {{ 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 %}
