Navbar plus propre.

This commit is contained in:
Hugo LEVY-FALK 2018-03-18 11:53:11 +01:00
parent 9fdd7c9786
commit 135129769e
3 changed files with 17 additions and 12 deletions

View file

@ -14,4 +14,7 @@
{% endif %} {% endif %}
</button> </button>
</form> </form>
{% if link %}
<a href="{{link}}">{{link_text}}</a>
{% endif %}
{% endblock %} {% endblock %}

View file

@ -18,7 +18,7 @@
{% for c in categories %} {% for c in categories %}
<li class="nav-item <li class="nav-item
{% if category.pk == c.pk %}active{%endif%}"> {% if category.pk == c.pk %}active{%endif%}">
<a class="nav-link" href="{% url 'content:category' c.pk %}">{{c.name}} <a class="nav-link" href="{% url 'content:category' c.pk %}"><i class="fas fa-video"></i> {{c.name}}
</a></li> </a></li>
{% endfor %} {% endfor %}
{% for p in static_pages %} {% for p in static_pages %}
@ -30,27 +30,23 @@
</ul> </ul>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">
{% if request.user.school %}
<li class="nav-item {% if school %}active{% endif %}"><a class="nav-link" href="{% url 'users:school' request.user.school.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 %} {% if request.user.is_authenticated %}
<li class="nav-item dropdown"> <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"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{request.user}} <i class="fa fa-user"></i> {{request.user}}
</a> </a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown"> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{% url 'users:logout' %}"><i class="fa fa-sign-out-alt"></i> Se déconnecter</a> <a class="dropdown-item" href="{% url 'users:logout' %}"><i class="fa fa-sign-out-alt"></i> Se déconnecter</a>
{% if request.user.school %}
<a class="dropdown-item" href="{% url 'users:school' request.user.school.pk %}"><i class="fas fa-graduation-cap"></i> Mon école</a>
{% endif %}
<a class="dropdown-item" href="{% url 'settings:index' %}"><i class="fas fa-cogs"></i> Administration</a>
</div> </div>
</li> </li>
{% else %} {% else %}
<li class="nav-item {% if active == 4 %}active{% endif %}"> <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> <a class="nav-link" href="{% url 'users:login' %}"><i class="fa fa-user"></i>Connexion<span class="sr-only">(current)</span></a>
</li> </li>
<li>
<a class="nav-link" href="{% url "users:password-reset" %}">(Mot de passe oublié)</a>
</li>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>

View file

@ -12,7 +12,13 @@ urlpatterns = [
), ),
path( path(
'login', 'login',
auth_views.LoginView.as_view(template_name="edit.html"), auth_views.LoginView.as_view(
template_name="edit.html",
extra_context={
'link_text':"Mot de passe oublié",
'link':reverse_lazy('users:password-reset')
}
),
name='login' name='login'
), ),
path( path(