<!DOCTYPE html>
{% load static %}
{% load i18n core_tags lib_tags %}
<html lang="{{ LANGUAGE_CODE }}">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>{% block pagetitle %}{% endblock %}</title>
    <link rel="icon" type="image/png" href="{% static 'css/logo-icon.png' %}" />
    <link rel="stylesheet" href="{% static 'font-awesome/css/font-awesome.min.css' %}">
    <link rel="stylesheet" href="{% static 'bootstrap/dist/css/bootstrap.min.css' %}" />
    <link rel="stylesheet" href="{% static 'eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css' %}" />
    <link rel="stylesheet" href="{% static 'selectize/dist/css/selectize.bootstrap3.css' %}" />
    <link rel="stylesheet" type="text/css" href="{% static 'css/custom.css' %}" />
    {% block extra_css %}{% endblock %}
  </head>

  <body>
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
      <div class="container-fluid">

          <button class="navbar-toggle collapsed pull-right" data-target="#topmenu" data-toggle="collapse" type="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>

          <button class="navbar-toggle collapsed pull-left" data-target="#leftcol" data-toggle="collapse" type="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>


        <div id="topmenu" class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            {% if user.is_admin %}
              <li{% if selection == "dashboard" %} class="active"{% endif %}>
                <a name="dashboard" href="{% url 'core:dashboard' %}">
                  <span class="fa fa-home fa-lg"></span>
                </a>
              </li>
            {% endif %}
            {% if selection %}
              {% extensions_menu selection user %}{% core_menu selection user %}
            {% else %}
              {% extensions_menu "" user %}{% core_menu "" user %}
            {% endif %}
            {% load_optionalmenu user %}
            <li class="divider"></li>
          </ul>
          <ul class="nav navbar-nav navbar-right">
            {% if selection %}{% user_menu user selection %}{% else %}{% user_menu user "" %}{% endif %}
          </ul>
          {% include "common/top_notifications.html" %}
        </div>
      </div>
    </div>

    {% block content %}{% endblock %}

    <!-- Javascript -->
    <script src="{% static 'jquery/jquery.min.js' %}" type="text/javascript"></script>
    <script src="{% static 'bootstrap/dist/js/bootstrap.min.js' %}" type="text/javascript"></script>
    <script type="text/javascript" src="{% static 'moment/min/moment.min.js' %}"></script>
    <script src="{% static 'eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min.js' %}" type="text/javascript"></script>
    <script src="{% static 'selectize/dist/js/standalone/selectize.min.js' %}" type="text/javascript"></script>
    {% if LANGUAGE_CODE != "en" %}<script src="{{ STATIC_URL }}moment/locale/{{ LANGUAGE_CODE }}.js" type="text/javascript"></script>{% endif %}
    {% if TEMPLATE_DEBUG %}
      <script src="//maxcdn.bootstrapcdn.com/bootlint/0.4.0/bootlint.min.js"></script>
    {% endif %}
    <script src="{% static 'js/global.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/csrf.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/confirmation.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/notify.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/poller.js' %}" type="text/javascript"></script>
    <script src="{% static 'js/top_notifications.js' %}" type="text/javascript"></script>
    <script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
    <script type="text/javascript">
      var top_notifications;
      var userLang = "{{ LANGUAGE_CODE }}";

      set_static_url("{{ STATIC_URL }}");
      $(document).ready(function() {
          top_notifications = new TopNotifications({
              url: "{% url 'core:top_notifications_check' %}",
              interval: {{ notifications_check_interval }}
          });
      });
    </script>
    {% extra_static_content "top" "js" user %}
    {% block extra_js %}{% endblock %}
  </body>
</html>
