site_tps/templates/nav_bar.html
2018-03-02 10:05:19 +01:00

52 lines
2.4 KiB
HTML

{% load categories %}
{% load load_settings %}
{% load_categories %}
{% load_site_settings %}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="{% url "home"%}">
{% if site_settings.site_logo %}
<img src="{{ site_settings.site_logo.url}}"/>
{% else %}
Il était une fois dans l'est
{% endif %}
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav mr-auto">
{% for c in categories %}
<li class="nav-item
{% if category.pk == c.pk %}active{%endif%}">
<a class="nav-link" href="{% url 'content:category-list' c.pk %}">{{c.name}}
</a></li>
{% endfor %}
</ul>
<ul class="navbar-nav ml-auto">
{% if request.user.userprofile.school %}
<li class="nav-item {% if school %}active{% endif %}"><a class="nav-link" href="{% url 'users:school' request.user.userprofile.school.group.pk %}"><i class="fas fa-graduation-cap"></i> Mon école</a></li>
{% endif %}
<li class="nav-item {% if settings %}active{% endif %}"><a class="nav-link" href="{% url 'settings:index' %}"><i class="fas fa-cogs"></i> Administration</a></li>
{% if request.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">
{{request.user}}
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{% url 'users:profile' request.user.pk%}"><i class="fa fa-user"></i> Accéder à mon profil</a>
<a class="dropdown-item" href="{% url 'users:logout' %}"><i class="fa fa-sign-out-alt"></i> Se déconnecter</a>
</div>
</li>
{% else %}
<li class="nav-item {% if active == 4 %}active{% endif %}">
<a class="nav-link" href="{% url 'users:login' %}">Connexion<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'users:new-user' %}">Inscription<span class="sr-only">(current)</span></a>
</li>
{% endif %}
</ul>
</div>
</nav>