{% load static %}
<html>
    <head>
        <title>Directory Tree</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
        <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>

        <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
        {% block head %}{% endblock head %}
        {% block css %}{% endblock %}
        {% block script %}{% endblock script %}

        <style>
            .navbar-custom {
                background-color: #2D3E52;   
            }
            .navbar-brand {
                color: #fff;    
            }
        </style>
    </head>
    <body>
        <nav class="navbar navbar-expand-lg navbar-dark navbar-custom">
            <a class="navbar-brand" style="color:#fff" href="#">Directory Tree</a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                <ul class="navbar-nav mr-auto">    
                    <li class="nav-item active">
                        <a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
                    </li>
                </ul>
                    <div class="btn-group nav-item dropdown my-2 my-lg-0"></li>
                        {% if user.username %}
                        <button type="button" class="btn btn-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        {{ user.username }}
                        </button>
                        <div class="dropdown-menu dropdown-menu-lg-right">
                            {% if user.is_superuser %}
                                <a href="/admin" class="dropdown-item">Admin</a>
                            {% endif %}
                        </div>
                        {% else %}
                            <button type="button" id="btn-login" class="btn btn-secondary">
                                Login
                            </button>
                        {% endif %}
                    </div>
            </div>
        </nav>
        <div class="p-4">
        {% block content %}
        {% endblock %}
        </div>

        <script>
            $("#btn-login").on("click", ()=>{
                window.location.href = "/admin/login/?next=/dir_tree/";
            })
        </script>
    </body>
</html>