diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-02-04 17:04:55 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-02-04 17:07:39 +0100 |
| commit | 82ad3593a4735055d9b362ab94bc4a9e4f20e4a4 (patch) | |
| tree | 89c1dd77aaa863c7369d762ab8e9f7aba63272b9 /backend/data.go | |
| parent | 2cab73140e45e1788af7810ddecbb251548d3fe6 (diff) | |
feat(frontend): smaller list display instead of bigger one
Diffstat (limited to 'backend/data.go')
| -rw-r--r-- | backend/data.go | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/backend/data.go b/backend/data.go index 4f9bab1..9fd6aea 100644 --- a/backend/data.go +++ b/backend/data.go @@ -92,9 +92,11 @@ func (d *data) handleGeneric(w http.ResponseWriter, r *http.Request, name string "asset": func(path string) *assetData { return getAsset(r.Context(), path) }, - "next": func(i int) int { return i + 1 }, - "before": func(i int) int { return i - 1 }, - "first": templateFirst, + "next": func(i int) int { return i + 1 }, + "before": func(i int) int { return i - 1 }, + "first": templateFirst, + "firstData": templateFirstData, + "restData": templateRestData, }).ParseFS(templates, "templates/components.html", fmt.Sprintf("templates/%s.html", name), "templates/base.html") if err != nil { panic(err) @@ -215,3 +217,17 @@ func templateFirst(a []*Section) *Section { } return a[0] } + +func templateFirstData(a []*sectionData) *sectionData { + if len(a) == 0 { + return nil + } + return a[0] +} + +func templateRestData(a []*sectionData) []*sectionData { + if len(a) < 2 { + return nil + } + return a[1:] +} |
