Add navbar

This commit is contained in:
Gabriel Augendre 2019-03-02 15:36:52 +01:00
parent aa8cd29e4d
commit ed56def4ea
4 changed files with 40 additions and 2 deletions

View file

@ -18,5 +18,6 @@ from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('accounts/', include('django.contrib.auth.urls')),
path('', include('map.urls')),
]

View file

@ -22,7 +22,7 @@
<title>{{ app.site.name }} &centerdot; {% block title %}Home{% endblock %}</title>
</head>
<body>
{#{% include 'map/navbar.html' %}#}
{% include 'map/navbar.html' %}
<div class="container">
{% for message in messages %}

View file

@ -0,0 +1,37 @@
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<a class="navbar-brand" href="{% url 'map' %}">{{ app.site.name }}</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">
<li class="nav-item">
<a class="nav-link" href="{{ git_version.url }}">Version : {{ git_version.name }}</a>
</li>
{% 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.get_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 'password_change' %}">Modifier le mot de passe</a>
<div role="separator" class="dropdown-divider"></div>
<a class="dropdown-item" href="{% url 'logout' %}">Déconnexion</a>
</div>
</li>
{% else %}
<li class="navbar-text">Anonyme</li>
{% endif %}
</ul>
</div>
</div>
</nav>

View file

@ -2,5 +2,5 @@ from django.urls import path
from map import views
urlpatterns = [
path('map/', views.MapView.as_view()),
path('', views.MapView.as_view(), name='map'),
]