rastrillo / abono Public

Clone
git clone https://amadan.net/rastrillo/abono

Plain git — no account needed to clone.

Download

Download this file

1{{/* abono-status — a holding as one line: a status pill, never colour alone.
2
3 The words come from Describe: its message key is translated, and when
4 it has a date the key's {date} is filled with it, inside a
5 <time datetime="2026-11-03"> so the date stays machine-readable. The
6 tone is Describe's, so the pill's colour and its words always agree.
7 A failing status with no known date has its own key, with no {date}.
8
9 The date reads year-month-day (2026-11-03) unless the app passes
10 DateText, the date already written for this reader ("3 November
11 2026"), as core's own partials take dates. A helper in core that
12 formats a date in the reader's locale is requested (rastrillo
13 discussion 112); until it lands, the app formats it.
14
15 Keys:
16 Holding abono.Holding, required — what to describe
17 Now time.Time, required — the moment to describe it at; the
18 same Now the access check uses, so the line cannot say
19 "active" of access that has ended
20 DateText string, optional — the date as shown; empty shows year-month-day
21 L *ui.Localizer — the request's, found by {{localizer $}};
22 add it with withL when calling from another partial */}}
23{{define "abono-status"}}{{$L := localizer $}}{{$s := .Holding.Describe .Now}}{{template "status-pill" dict "Tone" $s.Tone "Label" ($s.Sentence (T $L $s.Key) (or (opt . "DateText") ""))}}{{end}}
24