diff --git a/dashboard/__init__.py b/dashboard/__init__.py index e54b45e..3f5a70a 100644 --- a/dashboard/__init__.py +++ b/dashboard/__init__.py @@ -1,3 +1,4 @@ +import dataclasses from typing import Any from django.http import HttpRequest @@ -10,6 +11,16 @@ def register(fragment): return fragment +@dataclasses.dataclass +class Link: + text: str + href: str + tooltip: str | None = None + body: str | None = None + _: dataclasses.KW_ONLY + permission: str | None + + class DashboardFragment: name: str template: str @@ -18,3 +29,12 @@ class DashboardFragment: def __init__(self, request: HttpRequest): self.request = request + + +class LinksCardDashboardFragment(DashboardFragment): + template = "dashboard/links_card.dj.html" + links: [Link] = [] + + @property + def context(self): + return {"links": self.links} diff --git a/dashboard/templates/dashboard/dashboard.dj.html b/dashboard/templates/dashboard/dashboard.dj.html index b799b9d..dce1b4c 100644 --- a/dashboard/templates/dashboard/dashboard.dj.html +++ b/dashboard/templates/dashboard/dashboard.dj.html @@ -16,7 +16,7 @@