chore(index): Move the links outside of the class

This commit is contained in:
Tom Hubrecht 2024-09-24 14:27:44 +02:00
parent 2490d83459
commit 1dc8305027
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc
2 changed files with 21 additions and 23 deletions

View file

@ -1,4 +1,4 @@
<a class="button bt-link {{ link.color }}" href="{% url link.reverse %}">
<a class="button bt-link is-light {{ link.color }}" href="{% url link.reverse %}">
{% if link.icon %}<span class="icon"><i class="ti ti-{{ link.icon }}"></i></span>{% endif %}
<span>{{ link.text }}</span>
</a>

View file

@ -24,34 +24,32 @@ class Link(NamedTuple):
icon: str | None = None
AUTHENTICATED_LINKS: list[Link] = [
Link("is-primary", "dgsi:dgn-profile", _("Mon profil"), "user-filled"),
Link("is-primary", "dgsi:dgn-legal_documents", _("Documents Légaux"), "script"),
]
ADMIN_LINKS: list[Link] = [
Link(
"is-danger",
"dgsi:dgn-create_user",
_("Créer un nouveau compte Kanidm"),
"user-plus",
),
Link(
"is-warning", "admin:index", _("Interface d'administration"), "settings-filled"
),
]
class IndexView(TemplateView):
template_name = "dgsi/index.html"
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
return super().get_context_data(
links={
"authenticated": [
Link(
"is-primary",
"dgsi:dgn-profile",
_("Mon profil"),
"user-filled",
),
],
"admin": [
Link(
"is-danger",
"dgsi:dgn-create_user",
_("Créer un nouveau compte Kanidm"),
"user-plus",
),
Link(
"is-warning",
"admin:index",
_("Interface d'administration"),
"settings-filled",
),
],
"authenticated": AUTHENTICATED_LINKS,
"admin": ADMIN_LINKS,
},
**kwargs,
)