rastrillo / abono Public

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

Plain git — no account needed to clone.

Download

Download this file

1package abono
2
3import (
4 "embed"
5 "io/fs"
6)
7
8//go:embed templates/*.html
9var templatesFS embed.FS
10
11// Templates is abono's partials, rooted so callers parse "*.html", as
12// ui.Templates is. Parse them after ui's, with ui.Funcs:
13//
14// tmpl := template.New("").Funcs(ui.Funcs())
15// tmpl = template.Must(tmpl.ParseFS(ui.Templates(), "*.html"))
16// tmpl = template.Must(tmpl.ParseFS(abono.Templates(), "*.html"))
17//
18// The partials:
19//
20// abono-status {Holding, Now, DateText}: the holding as one status pill
21// abono-plan-card {Offer, Interval, Action, Code}: one plan at one interval
22// abono-plan-picker {Offers, Action}: the plans on sale, by interval
23// abono-paywall {Offers, SignedIn, SigninURL, Action, PlansURL}
24// abono-subscribe-button {Action, Plan, Interval, Label, Code}: a POST form
25// abono-billing-button {Action, Customer}: a POST form, one per customer
26//
27// Each finds the request's localizer under "L" in its data, as ui's
28// partials do; add it with withL when calling one from another template.
29// The words are message keys, "abono.*": merge Catalog() into the base
30// catalog (see Catalog).
31//
32// The partials carry no stylesheet. They use core's attributes and
33// tokens, so they follow the app's theme, light and dark.
34func Templates() fs.FS {
35 sub, err := fs.Sub(templatesFS, "templates")
36 if err != nil {
37 panic(err) // templates/ is embedded above; this cannot fail
38 }
39 return sub
40}
41