| 1 | {{/* The sign-in pages: the form, the check-your-email state and the |
| 2 | signed-out page. Each is the body of a page in the app's normal |
| 3 | layout, whose bar shows the brand only (no account, no Sign in). |
| 4 | |
| 5 | estilo-signin uses rastrillo's "field" and "callout" partials, so parse |
| 6 | ui.Templates() with ui.Funcs() alongside this package. The form sets |
| 7 | novalidate: an address error goes in the field's own error slot, never |
| 8 | the browser's bubble. Data: chrome.SignIn. */}} |
| 9 | |
| 10 | {{/* estilo-door-open / -close: the Oficina sign-in door around a card — |
| 11 | the suite's sky behind (sky.View in .Sky; none if it is empty) and the |
| 12 | app's own mark and name at the card's head (.App; the mark alone if |
| 13 | empty). The sky's markup is the same as the sky package's estilo-sky |
| 14 | template (chrome_test checks), repeated here so an app need not parse |
| 15 | the sky package's templates. An app that passes a Sky must also link |
| 16 | sky.css, mount sky.Handler at sky.Prefix, and allow img-src data: (the |
| 17 | placeholder is inline) — without sky.css the layers flow in the page. */}} |
| 18 | {{define "estilo-door-open"}}<div estilo-door estilo-sky-host> |
| 19 | {{- with .Sky.Layers}} |
| 20 | <div estilo-sky aria-hidden="true"> |
| 21 | {{- range .}} |
| 22 | <img estilo-sky-layer="{{.Name}}"{{with .Tone}} estilo-sky-tone="{{.}}"{{end}} src="{{with .Inline}}{{.}}{{else}}{{.Src}}{{end}}" alt=""{{if .Src}} decoding="async"{{end}}> |
| 23 | {{- end}} |
| 24 | </div> |
| 25 | {{- end}} |
| 26 | <section estilo-signin> |
| 27 | <p estilo-brand><img estilo-brand-icon="listing" src="{{.Icon}}" alt="" width="36" height="36">{{with .App}}<span>{{.}}</span>{{end}}</p> |
| 28 | {{- end}} |
| 29 | {{define "estilo-door-close"}}</section> |
| 30 | </div>{{end}} |
| 31 | {{define "estilo-signin"}}{{template "estilo-door-open" .}} |
| 32 | <h1>{{.Heading}}</h1> |
| 33 | {{- with .Lede}} |
| 34 | <p estilo-signin-lede>{{.}}</p> |
| 35 | {{- end}} |
| 36 | {{- with .Error}} |
| 37 | {{template "callout" (dict "Body" . "Tone" "negative" "Alert" true)}} |
| 38 | {{- end}} |
| 39 | <form rst-form estilo-signin-form method="post" action="{{.Action}}" novalidate> |
| 40 | {{- with .Return}} |
| 41 | <input type="hidden" name="return_to" value="{{.}}"> |
| 42 | {{- end}} |
| 43 | {{- range .Hidden}} |
| 44 | <input type="hidden" name="{{.Name}}" value="{{.Value}}"> |
| 45 | {{- end}} |
| 46 | {{template "field" (dict "ID" "estilo-signin-address" "Name" "address" "Type" "email" "Label" .AddressLabel "Autocomplete" "email" "Required" true "Autofocus" true "Value" .Address "Help" .Help "Error" .AddressError)}} |
| 47 | <div rst-form-foot><button rst-btn="primary" type="submit">{{.Submit}}</button></div> |
| 48 | </form> |
| 49 | {{- with .OpenSource}} |
| 50 | <p estilo-signin-foot><a href="{{.Href}}">{{.Label}}</a></p> |
| 51 | {{- end}} |
| 52 | {{template "estilo-door-close"}}{{end}} |
| 53 | |
| 54 | {{/* estilo-signin-sent: replaces the form once a link has been sent. Link |
| 55 | goes back to the form, keeping the return. Data: chrome.SignInNotice. */}} |
| 56 | {{define "estilo-signin-sent"}}{{template "estilo-door-open" .}} |
| 57 | <h1>{{.Heading}}</h1> |
| 58 | <p estilo-signin-body role="status">{{.Body}}</p> |
| 59 | {{- with .Link}} |
| 60 | <p><a href="{{.Href}}">{{.Label}}</a></p> |
| 61 | {{- end}} |
| 62 | {{template "estilo-door-close"}}{{end}} |
| 63 | |
| 64 | {{/* estilo-signed-out: where Sign out lands. Link is the primary |
| 65 | "Sign in". Data: chrome.SignInNotice. */}} |
| 66 | {{define "estilo-signed-out"}}{{template "estilo-door-open" .}} |
| 67 | <h1>{{.Heading}}</h1> |
| 68 | <p estilo-signin-body>{{.Body}}</p> |
| 69 | {{- with .Link}} |
| 70 | <p><a rst-btn="primary" href="{{.Href}}">{{.Label}}</a></p> |
| 71 | {{- end}} |
| 72 | {{template "estilo-door-close"}}{{end}} |
| 73 | |