{% macro menu_item(name, endpoint=None) -%}
<li{% if request.endpoint == endpoint %} class="active"{% endif %}><a href="{{ url_for(endpoint) if endpoint else "#" }}">{{ name }}</a></li>
{%- endmacro -%}
<!doctype html>
<html lang="fr">
  <head>
    {% block head -%}
    <meta charset="utf-8">
    <title>FFDN ISP Database</title>
    <!-- meta -->
    <link type="text/plain" rel="author" href="/humans.txt" />
    <!-- icon
    <link rel="shortcut icon" href="favicon.ico"> -->
    <!-- css -->
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/bootstrap.css') }}">
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/bootstrap-responsive.css') }}">
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/jquery.ui.all.css') }}">
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/bootstrap-select.min.css') }}">
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/leaflet.css') }}">
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/flags.css') }}">
    <link rel=stylesheet type=text/css href="{{ url_for('static', filename='css/style.css') }}">
    {%- endblock %}
  </head>
<body>
<div id="wrap">
  <div class="navbar navbar-static-top">
    <div class="navbar-inner">
      <div class="container">
        <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </a>
        <a class="brand" href="/"><span id="ffdn-header"><span>F</span><span>F</span><span>D</span><span>N</span></span> Database</a>
        <div class="nav-collapse collapse">
          <div id="locale-selector" data-target="#locale-modal" data-toggle="modal">
            <div class="flag flag-{{ current_locale()|locale_flag }}"></div>
            <div class="locale-name">{{ current_locale() }}</div>
          </div>
          <div class="pull-right divider-vertical locale-divider"></div>
          <form method="get" action="/search" class="navbar-search pull-right">
            <input type="text" id="search-input" class="search-query input-medium" name="q" placeholder="{{ _("Search") }}" />
          </form>
          <ul class="nav pull-right">
            {{ menu_item(_("Home"), 'ispdb.home') }}
            {{ menu_item(_("Project List"), 'ispdb.project_list') }}
            {{ menu_item(_("Format"), 'ispdb.format') }}
            {{ menu_item(_("API"), 'ispdb.api') }}
            <li class="divider-vertical"></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div id="locale-modal" class="modal hide" data-remote="{{ url_for('ispdb.locale_selector') }}">
    <form method="post" action="{{ url_for('ispdb.locale_selector') }}">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3>{{ _("Choose your language") }}</h3>
      </div>
      <div class="modal-body"></div>
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">{{ _("Close") }}</button>
        <button class="btn btn-primary">{{ _("Confirm") }}</button>
      </div>
    </form>
  </div>

  <div id="main-container" class="container">
    {%- with messages = get_flashed_messages(with_categories="true") -%}
    {%- if messages -%}
    {%- for category, message in messages %}
    <div class="alert alert-{{ category }} fade in">
      <button class="close" data-dismiss="alert">×</button>
      {{ message }}
    </div>
    {%- endfor -%}
    {%- endif -%}
    {% endwith %}
    {%- block container %}
    <div class="page-header">
      {% block page_header -%}
      <h2>{% block page_title %}{% endblock %}</h2>
      {%- endblock %}
    </div>
    <div class="container">
    {%- block body %}{% endblock %}
    </div>
    {%- endblock container %}
  </div>

  <div id="push"></div>
</div>

<footer>
  <div class="container">
    <div class="bracket"></div>
    <p class="credit">Developed for the <a href="//ffdn.org">FDN Federation</a> by Gu1@<a href="https://www.cafai.fr">CAFAI</a> and <a href="/humans.txt">Many contributors</a>.</p>
    <p class="license"><a href="https://dev.cafai.fr/gitweb/?p=ffdn-db.git">Source code</a> licensed under the <a href="http://opensource.org/licenses/BSD-3-Clause">3-clause BSD license</a>.</p>
    <p class="contact">You can contact us at <a href="mailto:contact@ffdn.org">contact@ffdn.org</a>.</p>
  </div>
</footer>

{% block script -%}
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/bootstrap.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/bootstrap-select.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/leaflet.js') }}"></script>
<script type="text/javascript" src="{{ url_for('ispdb.site_js') }}"></script>
{%- endblock %}
</body>

</html>
