oficina / slides Public

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

Plain git — no account needed to clone.

Download

Download this file

1{{/* export_status — GET /d/{sqid}/export/{job}, where the button lands.
2
3 Built twice (render.go): as a page, and as the bare "export-body"
4 the shim polls. That is why the running and finished states are
5 ALTERNATIVES rather than a result appended under a spinner — the
6 shim keeps the first element of what it fetches and drops the
7 rest, so a fragment has to be one element, and the element that
8 replaces the spinner is the result.
9
10 While it is running the element is ui's own job-status partial,
11 which carries data-poll (and data-poll-push for a browser that can
12 take server-sent events) and drops it when the job is done, which
13 is what stops the loop. With scripts off the meta refresh below
14 does the same job more slowly — and only while the job is running,
15 or a finished page would refresh for ever. */}}
16{{define "page-head"}}{{if .Running}}<noscript><meta http-equiv="refresh" content="{{.PollSeconds}}"></noscript>{{end}}{{end}}
17
18{{define "export-body"}}
19{{- if .Running}}
20{{template "job-status" dict
21 "Name" .Name "Status" .Status "Progress" .Progress
22 "PollURL" .PollURL "PollSeconds" .PollSeconds "PushURL" .PushURL}}
23{{- else}}
24<div slides-export>
25 {{- if .Failed}}
26 {{template "callout" dict "Tone" "negative" "Title" .Name "Body" .Err "Alert" true}}
27 {{- else if .Gone}}
28 {{template "callout" dict "Tone" "warning" "Title" .Name "Body" .Gone}}
29 {{- else}}
30 <p>{{.Done}}</p>
31 <p><a rst-btn="primary lg" href="{{.DownloadHref}}">{{.DownloadLabel}}</a></p>
32 <p rst-text-muted>{{.Held}}</p>
33 {{- if .Warnings}}
34 <h2>{{.WarningsLabel}}</h2>
35 <p>{{.WarningsBody}}</p>
36 <ul slides-export-warnings>
37 {{- range .Warnings}}
38 <li>{{with .Slide}}<strong>{{.}}</strong> — {{end}}{{.Detail}}</li>
39 {{- end}}
40 </ul>
41 {{- end}}
42 {{- end}}
43 <p><a href="{{.AgainHref}}">{{.AgainLabel}}</a></p>
44</div>
45{{- end}}
46{{end}}
47
48{{define "content"}}
49{{template "back-nav" dict "Href" .BackHref "Label" .BackLabel}}
50{{template "page-header" dict "Title" .Title "Sub" .Name}}
51{{template "export-body" .}}
52{{end}}
53