feat(templates): Add a visual indication that some pages give more power

This commit is contained in:
Tom Hubrecht 2024-10-12 07:58:19 +02:00
parent f6fcd90622
commit 6921373d6c
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc
2 changed files with 16 additions and 1 deletions

View file

@ -14,3 +14,7 @@ class StaffRequiredMixin(UserPassesTestMixin):
assert isinstance(self.request.user, User)
return self.request.user.is_admin
def get_context_data(self, **kwargs):
# NOTE: We are only allowed to do this if a class is supplied to the right when constructing the view
return super().get_context_data(admin_view=True, **kwargs) # pyright: ignore

View file

@ -1,6 +1,6 @@
{% load i18n %}
<section class="hero is-dark is-primary">
<section class="hero {% if admin_view %}is-danger{% else %}is-primary{% endif %}">
<div class="hero-body px-0">
<div class="columns mx-6">
<div class="column is-three-quarters">
@ -66,4 +66,15 @@
</div>
</div>
</div>
{% if admin_view %}
<div class="hero is-dark">
<div class="hero-body py-2 has-text-centered">
<span class="icon">
<i class="ti ti-lock-open-2"></i>
</span>
<span>{% trans "Interface d'administration" %}</span>
</div>
</div>
{% endif %}
</section>