oficina / mapa Public

Clone
git clone https://amadan.net/oficina/mapa

Plain git — no account needed to clone.

Download

Download this file

1{{/* look: a team page's icon and banner, with no script (columns and
2 icons spec §2.5, §3.3). Every control is its own form: an emoji, a
3 picture uploaded as the icon, a picture uploaded as the banner, the
4 banner's position, and each removal. Data: lookPage. */}}
5{{define "content"}}{{$d := .Data}}{{$page := $d.Page}}{{$action := printf "%s/look" $page.Href}}
6{{template "back-nav" dict "Href" $page.Href "Label" $page.Label}}
7{{template "page-header" dict "Title" "Icon and banner" "Sub" "Everyone in the team sees the icon and banner wherever this page's title appears."}}
8{{template "notice" $d.Notice}}
9{{with $d.Error}}<p rst-field-error role="alert" mapa-look-error>{{.}}</p>{{end}}
10<section mapa-look-section rst-stack rst-section aria-labelledby="look-icon" id="icon">
11<h2 id="look-icon">Icon</h2>
12{{with $page.Look}}<p mapa-look-now>{{pageIcon . ""}} Current icon</p>{{end}}
13<form rst-form method="post" action="{{$action}}" mapa-look-form>
14<input type="hidden" name="do" value="emoji">
15<label rst-field-label for="look-emoji">Emoji</label>
16<input rst-input id="look-emoji" name="emoji" value="{{$d.Emoji}}" maxlength="64" autocomplete="off" aria-describedby="look-emoji-hint">
17<small rst-field-hint id="look-emoji-hint">One emoji. Your keyboard's emoji picker works here.</small>
18<button rst-btn type="submit">Use this emoji</button>
19</form>
20<form rst-form method="post" action="{{$action}}?upload=1&amp;for=icon" enctype="multipart/form-data" mapa-look-form>
21<label rst-field-label for="look-icon-file">Or a picture</label>
22<input type="file" id="look-icon-file" name="file" accept="image/png,image/jpeg,image/gif,image/webp" aria-describedby="look-icon-hint">
23<small rst-field-hint id="look-icon-hint">PNG, JPEG, GIF or WebP, up to {{number L 128}} KB and {{number L 512}} pixels on each side.</small>
24<button rst-btn type="submit">Upload icon</button>
25</form>
26{{if $page.Look}}<form method="post" action="{{$action}}" mapa-look-form><input type="hidden" name="do" value="remove-icon"><button rst-btn type="submit">Remove icon</button></form>{{end}}
27</section>
28<section mapa-look-section rst-stack rst-section aria-labelledby="look-banner" id="banner">
29<h2 id="look-banner">Banner</h2>
30<form rst-form method="post" action="{{$action}}?upload=1&amp;for=banner" enctype="multipart/form-data" mapa-look-form>
31<input type="hidden" name="y" value="50">
32<label rst-field-label for="look-banner-file">{{if $d.Banner}}Replace with a new picture{{else}}A picture{{end}}</label>
33<input type="file" id="look-banner-file" name="file" accept="image/png,image/jpeg,image/gif,image/webp" aria-describedby="look-banner-hint">
34<small rst-field-hint id="look-banner-hint">A wide picture works best. Mapa crops it to a band across the top of the page.</small>
35<button rst-btn type="submit">Upload banner</button>
36</form>
37{{with $d.Banner}}<form rst-form method="post" action="{{$action}}" mapa-look-form>
38<input type="hidden" name="do" value="position">
39<fieldset><legend rst-field-label>Choose which part to show</legend>
40<label><input type="radio" name="y" value="0"{{if eq .Y 0}} checked{{end}}> Top</label>
41<label><input type="radio" name="y" value="50"{{if eq .Y 50}} checked{{end}}> Centre</label>
42<label><input type="radio" name="y" value="100"{{if eq .Y 100}} checked{{end}}> Bottom</label>
43</fieldset>
44<button rst-btn type="submit">Save banner position</button>
45</form>
46<form method="post" action="{{$action}}" mapa-look-form><input type="hidden" name="do" value="remove-banner"><button rst-btn type="submit">Remove banner</button></form>{{end}}
47</section>
48{{end}}
49