rastrillo / abono Public

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

Plain git — no account needed to clone.

Download

Download this file

1{{/* abono-paywall — what stands where locked content would be: why it
2 is locked, and the way in. A reader who is not signed in is asked to
3 sign in (they cannot buy as no one); a signed-in reader sees the
4 plans, or a link to them.
5
6 The block is a padded box when it holds only words and a button; with
7 the picker inline the plan boxes are the boxes, and it is a plain section.
8
9 Keys:
10 Offers []abono.Offer, required — from Service.Offers
11 SignedIn bool, required
12 SigninURL string — where "sign in" goes; used when not SignedIn
13 Action string — where the buy forms post; used when SignedIn
14 PlansURL string, optional — when set, a signed-in reader gets a
15 "see plans" link there instead of the picker inline
16 L *ui.Localizer */}}
17{{define "abono-paywall"}}{{$L := localizer $}}<section{{if or (not .SignedIn) (opt . "PlansURL")}} rst-box{{end}}><h2>{{T $L "abono.paywall.title"}}</h2><p>{{T $L "abono.paywall.body"}}</p>{{if .SignedIn}}{{with opt . "PlansURL"}}<p><a rst-btn="primary" href="{{.}}">{{T $L "abono.button.see_plans"}}</a></p>{{else}}{{template "abono-plan-picker" dict "L" $L "Offers" $.Offers "Action" (or (opt $ "Action") "")}}{{end}}{{else}}<p>{{T $L "abono.paywall.signin_prompt"}}</p><p><a rst-btn="primary" href="{{or (opt . "SigninURL") ""}}">{{T $L "abono.paywall.signin"}}</a></p>{{end}}</section>{{end}}
18