Download this file
| 1 | {{/* abono-plan-card — one plan at one interval: its name, the price |
| 2 | that is sold for it, and a button to buy. |
| 3 | |
| 4 | A plan with nothing sold at Interval says so ("abono.plan.interval_unavailable") |
| 5 | and offers no button, rather than quietly selling another interval. |
| 6 | Prices that are no longer sold (legacy prices) are never shown, nor |
| 7 | is a price billed other than every month or every year |
| 8 | (Price.Unsupported). |
| 9 | |
| 10 | Keys: |
| 11 | Offer abono.Offer, required |
| 12 | Interval string, optional — "month" or "year". Empty shows every |
| 13 | sold price, which is right for a plan with just one; with |
| 14 | several the button cannot choose between them, so name one. |
| 15 | Action string, required — where the buy form posts |
| 16 | Code bool, optional — a promotion code field in the buy form |
| 17 | L *ui.Localizer */}} |
| 18 | {{define "abono-plan-card"}}{{$L := localizer $}}{{$iv := or (opt . "Interval") ""}}{{$found := false}}<div rst-box><h3>{{or .Offer.Name .Offer.Plan}}</h3>{{range .Offer.Prices}}{{if and .Sold (not .Unsupported) (or (eq $iv "") (eq .Interval $iv))}}{{$found = true}}{{if .Currency}}<p>{{template "abono-price" dict "L" $L "Price" .}}</p>{{end}}{{end}}{{end}}{{if $found}}{{template "abono-subscribe-button" dict "L" $L "Action" .Action "Plan" .Offer.Plan "Interval" $iv "Code" (opt . "Code")}}{{else}}<p>{{T $L "abono.plan.interval_unavailable"}}</p>{{end}}</div>{{end}} |
| 19 | |