Add: add user dropdown

with django admin link if admin or staff and logout link
This commit is contained in:
Aroy-Art 2024-07-05 22:25:31 +02:00
parent 57cf266b56
commit c6092a118d
Signed by: Aroy
GPG key ID: DB9689E9391DD156

View file

@ -99,6 +99,52 @@
<hr class="d-lg-none my-2">
</li>
<!-- User Dropdown -->
<li class="nav-item ms-lg-auto mx-2 dropdown">
<a class="nav-link dropdown-toggle text-body-emphasis" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{% if user.first_name %}
{{ user.first_name }}
{% else %}
{{ user.username }}
{% endif %}
</a>
<ul class="dropdown-menu dropdown-menu-end">
<li>
<a class="dropdown-item" href="{% url 'profile' %}">
<i class="nf nf-fa-user"></i>
<p class="d-inline font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Settings">User Settings</p>
</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
{% if user.is_superuser %}
<li>
<a class="dropdown-item" href="{% url 'admin:index' %}">
<i class="nf nf-fa-warning"></i>
<p class="d-inline font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Django Admin">Djnago Admin</p>
</a>
</li>
{% endif %}
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="{% url 'logout' %}">
<i class="nf nf-md-logout"></i>
<p class="d-inline font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Sign out">Logout</p>
</a>
</li>
</ul>
</li>
<!-- End User Dropdown -->
{% else %}
<!-- Theme Selector -->
@ -141,14 +187,6 @@
</li>
<!-- End Theme Selector -->
{% if request.user.is_authenticated %}
<li class="nav-item ms-lg-auto">
<a class="nav-link nav-link-icon me-2"
href="{% url 'logout' %}">
<i class="fa fa-sign-out me-1"></i>
<p class="d-inline text-sm z-index-1 font-weight-bold" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Sign out">Logout</p>
</a>
</li>
{% endif %}
</ul>