Add a navbar

This commit is contained in:
Gabriel Augendre 2018-03-04 20:58:21 +01:00
parent 8edc9c03f4
commit ff7e12759d
No known key found for this signature in database
GPG key ID: F360212F958357D4
2 changed files with 34 additions and 0 deletions

View file

@ -11,6 +11,8 @@
<title>Gym &centerdot; {% block title %}Home{% endblock %}</title> <title>Gym &centerdot; {% 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">

View 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>