{#-
 This file is part of Supysonic.
 Supysonic is a Python implementation of the Subsonic server API.

 Copyright (C) 2013-2021 Alban 'spl0k' Féron
                    2017 Óscar García Amor

 Distributed under terms of the GNU AGPLv3 license.
-#}
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Supysonic</title>

    <!-- Bootstrap -->
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/bootstrap-theme.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/supysonic.css') }}" rel="stylesheet">

  </head>
  <body>
    <nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          {% if session.userid %}
          <button type="button" class="navbar-toggle collapsed"
                                data-toggle="collapse"
                                data-target="#supysonic-navbar-collapse"
                                aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          {% endif %}
          <span class="navbar-brand">Supysonic</span>
        </div>
        {% if session.userid %}
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse"
             id="supysonic-navbar-collapse">
          <ul class="nav navbar-nav">
            {% block navbar_index %}
            <li><a href="{{ url_for('frontend.index') }}">Home</a></li>
            {% endblock %}
            {% block navbar_playlists %}
            <li><a href="{{ url_for('frontend.playlist_index') }}">Playlists</a></li>
            {% endblock %}
            {% if request.user.admin %}
            {% block navbar_users %}
            <li><a href="{{ url_for('frontend.user_index') }}">Users</a></li>
            {% endblock %}
            {% block navbar_folders %}
            <li><a href="{{ url_for('frontend.folder_index') }}">Folders</a></li>
            {% endblock %}
            {% endif %}
            {% block navbar_profile %}
            <li><a href="{{ url_for('frontend.user_profile', uid = 'me')}}">{{ request.user.name }}</a></li>
            {% endblock %}
          </ul>
          <ul class="nav navbar-nav navbar-right">
            <li><a href="{{ url_for('frontend.logout') }}">Log out</a></li>
          </ul>
        </div><!-- /.navbar-collapse -->
        {% endif %}
      </div><!-- /.container -->
    </nav>

    <div class="container">
      {% if get_flashed_messages() %}
      <div class="alert alert-info alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        {% for message in get_flashed_messages() %}
        <p>{{ message }}</p>
        {% endfor %}
      </div>
      {% endif %}

      <div class="row">
        {% block body %}{% endblock %}
      </div><!--/row-->

      <hr />
      <footer>
        <p>Supysonic version {{ version }}. Its
          <a href="{{ download_url }}/tree/{{ version }}">source code</a> is available
          under the <a href="http://www.gnu.org/licenses/agpl-3.0.html">GNU Affero
            General Public License version 3</a>.</p>
      </footer>
    </div> <!-- /container -->

    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
    <!-- Activate tooltips -->
    <script src="{{ url_for('static', filename='js/supysonic.js') }}"></script>
  </body>
</html>
