{% load static %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="{% static "css/styles.css" %}">
    <link rel="stylesheet" href="{% static "css/bootstrap.min.css" %}">
    <title>Document</title>
</head>
<body>
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
        <div class="container"> 
            <a class="navbar-brand" href="{% url 'index' %}">Navbar</a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse flex-grow-0" id="navbarNav">
                <ul class="navbar-nav">
                
                {% if perms.webapp.add_article %}
                    <li class="nav-item">
                        <a class="nav-link" aria-current="page" href="{% url 'articles_add' %}">Create</a>
                    </li>
                {% endif %}

                <form class="d-flex">
                    <input class="form-control me-2" name="search" type="search" placeholder="Search" aria-label="Search">
                    <button class="btn btn-outline-success" type="submit">Search</button>
                </form>

                {% if user.is_authenticated %}
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'logout' %}?next={{ request.get_full_path }}">Logout</a>
                    </li>
                    <li class="nav-item">
                        <span class="nav-link fw-bold">
                            Hello, <a href="{% url 'profile' user.id %}" class="text-decoration-none text-secondary">{{ user.username }}</a>
                        </span>
                    </li>

                {% else %}
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'login' %}?next={{ request.get_full_path }}">Login</a>
                    </li>
                {% endif %}

                </ul>
            </div>
        </div>
    </nav>

    <div class="container">
        {% block content %}

        {% endblock %}
    </div>

    <script>
        let a = 1

    </script>
</body>
</html>