package abono import ( "embed" "io/fs" ) //go:embed templates/*.html var templatesFS embed.FS // Templates is abono's partials, rooted so callers parse "*.html", as // ui.Templates is. Parse them after ui's, with ui.Funcs: // // tmpl := template.New("").Funcs(ui.Funcs()) // tmpl = template.Must(tmpl.ParseFS(ui.Templates(), "*.html")) // tmpl = template.Must(tmpl.ParseFS(abono.Templates(), "*.html")) // // The partials: // // abono-status {Holding, Now, DateText}: the holding as one status pill // abono-plan-card {Offer, Interval, Action, Code}: one plan at one interval // abono-plan-picker {Offers, Action}: the plans on sale, by interval // abono-paywall {Offers, SignedIn, SigninURL, Action, PlansURL} // abono-subscribe-button {Action, Plan, Interval, Label, Code}: a POST form // abono-billing-button {Action, Customer}: a POST form, one per customer // // Each finds the request's localizer under "L" in its data, as ui's // partials do; add it with withL when calling one from another template. // The words are message keys, "abono.*": merge Catalog() into the base // catalog (see Catalog). // // The partials carry no stylesheet. They use core's attributes and // tokens, so they follow the app's theme, light and dark. func Templates() fs.FS { sub, err := fs.Sub(templatesFS, "templates") if err != nil { panic(err) // templates/ is embedded above; this cannot fail } return sub }