oficina / fichas Public

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

Plain git — no account needed to clone.

Download

Download this file

1{{define "title"}}History of {{.Card.Title}} · Fichas{{end}}
2{{define "content"}}{{$c := .Card}}{{$L := .L}}
3<header fichas-page-head>
4 <h1>History of {{$c.Title}}</h1>
5 <p fichas-meta><a href="/cards/{{$c.Card.ID}}">{{icon "arrow-left"}} Back to the card</a></p>
6</header>
7{{template "fichas-notice" (dict "N" .Notice "Here" .Here)}}
8<p fichas-meta>Each change to this {{lower $c.TypeLabel}}, newest first. For 90 days, each change keeps the values it replaced. You can put any of them back. After that, history keeps who changed what and when.</p>
9<ol fichas-history>
10{{range .Items}}{{$item := .}}
11 <li fichas-history-item>
12 <p fichas-history-head>
13 <strong>{{if .Who}}{{personName .Who}}{{else}}Fichas{{end}}</strong>
14 {{if eq .Kind "created"}}created this {{lower $c.TypeLabel}}
15 {{else if eq .Kind "entry_added"}}logged a call
16 {{else if .Undo}}undid an earlier change
17 {{else if .Redo}}redid a change
18 {{else}}changed {{range $i, $f := .Fields}}{{if $i}}, {{end}}{{$f.Label}}{{end}}{{end}}
19 <time datetime="{{.When.Format "2006-01-02T15:04:05Z07:00"}}" title="{{stamp $.L .When}}"{{with agoLang $.L .When}} lang="{{.}}"{{end}}>{{ago $.L .When}}</time>
20 </p>
21 {{if and .Held .Fields (ne .Kind "entry_added")}}
22 <dl fichas-history-values>
23 {{range .Fields}}{{if .Key}}
24 <dt>{{.Label}}</dt>
25 <dd>
26 <span fichas-history-before>{{with showValue $L .Kind .Before}}{{.}}{{else}}<span fichas-empty-cell>empty</span>{{end}}</span>
27 <span aria-hidden="true"> → </span><span class="rst-sr-only"> to </span>
28 <span fichas-history-after>{{with showValue $L .Kind .After}}{{.}}{{else}}<span fichas-empty-cell>empty</span>{{end}}</span>
29 {{$now := index $.Now .Key}}{{if and (ne $item.Kind "created") (not (sameText $now .Before))}}
30 <form method="post" action="/cards/{{$c.Card.ID}}/fields/{{.Key}}" fichas-restore>
31 <input type="hidden" name="was.{{.Key}}" value="{{$now}}">
32 <input type="hidden" name="{{.Key}}" value="{{seed $L ($c.Field .Key).Def .Before}}">
33 {{if eq .Kind "number"}}<input type="hidden" name="{{.Key}}.locale" value="{{$L.Format}}">{{end}}
34 <input type="hidden" name="return_to" value="{{$.Here}}">
35 <button rst-btn="sm" type="submit">{{icon "undo-2"}}Restore this value</button>
36 </form>{{end}}
37 </dd>
38 {{end}}{{end}}
39 </dl>
40 {{end}}
41 </li>
42{{else}}
43 <li fichas-meta>No changes yet.</li>
44{{end}}
45</ol>
46{{end}}
47