diff options
Diffstat (limited to 'internal/web/templates/partials/fontpick.html')
| -rw-r--r-- | internal/web/templates/partials/fontpick.html | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/web/templates/partials/fontpick.html b/internal/web/templates/partials/fontpick.html new file mode 100644 index 0000000..35820a2 --- /dev/null +++ b/internal/web/templates/partials/fontpick.html @@ -0,0 +1,13 @@ +{{/* One font field of the design page: a select of the recent library fonts + (plus a chosen one older than those, named through .names) and an upload + input. No library panel behind it — a blog has a handful of fonts — and + no script: the select is what the form sends (see pickFile). */}} +{{define "fontpick"}}{{$cur := .current}}{{$listed := false}}{{range .fonts}}{{if eq .ID.String $cur}}{{$listed = true}}{{end}}{{end}}<div class="fontpick"> + <label>{{.label}}<br><select name="{{.name}}"> + <option value="none"{{if not $cur}} selected{{end}}>{{t "None"}}</option> + {{range .fonts}}<option value="{{.ID}}"{{if eq .ID.String $cur}} selected{{end}}>{{.Filename}}</option>{{end}} + {{if and $cur (not $listed)}}<option value="{{$cur}}" selected>{{with index .names $cur}}{{.}}{{else}}{{t "Current font"}}{{end}}</option>{{end}} + </select></label> + <label class="upload">{{t "…or upload a new one"}}<br><input type="file" name="{{.name}}_file" accept=".woff2,.woff,.ttf,.otf,font/woff2,font/woff,font/ttf,font/otf"></label> + {{if .hint}}<p class="muted small">{{.hint}}</p>{{end}} +</div>{{end}} |
