Add a navbar
This commit is contained in:
parent
8edc9c03f4
commit
ff7e12759d
2 changed files with 34 additions and 0 deletions
|
@ -11,6 +11,8 @@
|
||||||
<title>Gym · {% block title %}Home{% endblock %}</title>
|
<title>Gym · {% block title %}Home{% endblock %}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
{% include 'gym/navbar.html' %}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% for message in messages %}
|
{% for message in messages %}
|
||||||
<div class="alert alert-dismissible alert-{{ message.tags }} fade show" role="alert">
|
<div class="alert alert-dismissible alert-{{ message.tags }} fade show" role="alert">
|
||||||
|
|
32
gym/templates/gym/navbar.html
Normal file
32
gym/templates/gym/navbar.html
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="{% url 'rooms-list' %}">Workout</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 ml-auto">
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<li class="nav-item dropdown">
|
||||||
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
|
||||||
|
data-toggle="dropdown"
|
||||||
|
aria-haspopup="true" aria-expanded="false">
|
||||||
|
{% firstof user.full_name user.username %}
|
||||||
|
</a>
|
||||||
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
||||||
|
{% if user.is_staff %}
|
||||||
|
<a class="dropdown-item" href="{% url 'admin:index' %}">Admin</a>
|
||||||
|
<div role="separator" class="dropdown-divider"></div>
|
||||||
|
{% endif %}
|
||||||
|
<a class="dropdown-item" href="{% url 'logout' %}">Déconnexion</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="nav-item">Anonyme</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
Loading…
Reference in a new issue