| 1 | {{/* estilo-account: the account menu, the same in every app and always |
| 2 | the last thing in the bar. Data: chrome.Account. |
| 3 | |
| 4 | Order: who is signed in (not interactive), the app's account-scoped |
| 5 | items, Appearance, Help, then Sign out, which appears exactly once in |
| 6 | the app. Appearance is a form of three buttons; the current one is |
| 7 | aria-pressed="true" and every other "false", and the check glyph, not |
| 8 | colour, shows which. |
| 9 | |
| 10 | Rail (Account.Rail) puts it at a sidebar rail's foot instead: the |
| 11 | trigger is a row naming who is signed in, and the panel opens upward |
| 12 | where the rail is the viewport's height. */}} |
| 13 | {{define "estilo-account"}}<details estilo-account{{if .Rail}}="rail"{{end}} name="estilo-menus"> |
| 14 | <summary estilo-bar-trigger aria-label="{{.TriggerLabel}}"> |
| 15 | {{- if .Initials}}<span estilo-avatar aria-hidden="true">{{.Initials}}</span>{{else}}{{template "estilo-icon-person"}}{{end -}} |
| 16 | {{- if .Rail}}{{with or .Name .Address}}<span estilo-account-who dir="auto">{{.}}</span>{{end}}{{end -}} |
| 17 | </summary> |
| 18 | <div estilo-menu estilo-account-panel> |
| 19 | <div estilo-menu-identity> |
| 20 | <span estilo-menu-identity-label>{{.Labels.SignedInAs}}</span> |
| 21 | {{- with .Name}}<span estilo-menu-identity-name dir="auto">{{.}}</span>{{end}} |
| 22 | {{- with .Address}}<span estilo-menu-identity-address dir="auto">{{.}}</span>{{end}} |
| 23 | </div> |
| 24 | {{- if .Items}}<hr>{{range .Items}}{{template "estilo-menu-item" .}}{{end}}{{end}} |
| 25 | {{- with .Appearance}} |
| 26 | <hr> |
| 27 | <p estilo-menu-heading id="estilo-appearance">{{$.Labels.Appearance}}</p> |
| 28 | <form method="post" action="{{.Action}}" role="group" aria-labelledby="estilo-appearance"> |
| 29 | <input type="hidden" name="return_to" value="{{.Return}}"> |
| 30 | {{- range .Options}} |
| 31 | <button estilo-menu-item type="submit" name="mode" value="{{.Value}}" aria-pressed="{{if .Current}}true{{else}}false{{end}}"><span estilo-menu-check aria-hidden="true">{{template "estilo-icon-check"}}</span><span estilo-menu-label>{{.Label}}</span></button> |
| 32 | {{- end}} |
| 33 | </form> |
| 34 | {{- end}} |
| 35 | {{- if .Help}} |
| 36 | <hr> |
| 37 | <p estilo-menu-heading>{{.Labels.Help}}</p> |
| 38 | {{- range .Help}}{{template "estilo-menu-item" .}}{{end}} |
| 39 | {{- end}} |
| 40 | <hr> |
| 41 | <form method="post" action="{{.SignOut.Action}}"> |
| 42 | <button estilo-menu-item type="submit"><span estilo-menu-label>{{.SignOut.Label}}</span></button> |
| 43 | </form> |
| 44 | </div> |
| 45 | </details>{{end}} |
| 46 | |