chore(index): Move the links outside of the class
This commit is contained in:
parent
2490d83459
commit
1dc8305027
2 changed files with 21 additions and 23 deletions
|
@ -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 %}
|
{% if link.icon %}<span class="icon"><i class="ti ti-{{ link.icon }}"></i></span>{% endif %}
|
||||||
<span>{{ link.text }}</span>
|
<span>{{ link.text }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -24,21 +24,12 @@ class Link(NamedTuple):
|
||||||
icon: str | None = None
|
icon: str | None = None
|
||||||
|
|
||||||
|
|
||||||
class IndexView(TemplateView):
|
AUTHENTICATED_LINKS: list[Link] = [
|
||||||
template_name = "dgsi/index.html"
|
Link("is-primary", "dgsi:dgn-profile", _("Mon profil"), "user-filled"),
|
||||||
|
Link("is-primary", "dgsi:dgn-legal_documents", _("Documents Légaux"), "script"),
|
||||||
|
]
|
||||||
|
|
||||||
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
|
ADMIN_LINKS: list[Link] = [
|
||||||
return super().get_context_data(
|
|
||||||
links={
|
|
||||||
"authenticated": [
|
|
||||||
Link(
|
|
||||||
"is-primary",
|
|
||||||
"dgsi:dgn-profile",
|
|
||||||
_("Mon profil"),
|
|
||||||
"user-filled",
|
|
||||||
),
|
|
||||||
],
|
|
||||||
"admin": [
|
|
||||||
Link(
|
Link(
|
||||||
"is-danger",
|
"is-danger",
|
||||||
"dgsi:dgn-create_user",
|
"dgsi:dgn-create_user",
|
||||||
|
@ -46,12 +37,19 @@ class IndexView(TemplateView):
|
||||||
"user-plus",
|
"user-plus",
|
||||||
),
|
),
|
||||||
Link(
|
Link(
|
||||||
"is-warning",
|
"is-warning", "admin:index", _("Interface d'administration"), "settings-filled"
|
||||||
"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": AUTHENTICATED_LINKS,
|
||||||
|
"admin": ADMIN_LINKS,
|
||||||
},
|
},
|
||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue