Download this file
| 1 | {{/* mapa-history: the History panel (level-up §4.5), parsed into every |
| 2 | page. On /p/{id}/history it is drawn beside the page; history.js |
| 3 | fetches the same markup with ?panel=1 and shows it in place. Close |
| 4 | and Back to current are links to the page, so both work with |
| 5 | scripts off; Restore is the existing POST, held by busy.js. |
| 6 | Data: historyPanel. */}} |
| 7 | {{define "mapa-history"}}<aside mapa-history id="mapa-history" aria-labelledby="mapa-history-title" data-state="{{.State}}"> |
| 8 | <div mapa-history-head> |
| 9 | <h2 id="mapa-history-title" tabindex="-1">History</h2> |
| 10 | <a mapa-history-close href="{{.Close}}" aria-label="Close history" data-mapa-history-close>{{icon "x"}}</a> |
| 11 | </div> |
| 12 | <p mapa-history-lede>Every saved version from the last 90 days. Restoring one saves it as the newest; nothing is lost.</p> |
| 13 | <div mapa-history-list> |
| 14 | {{- range .Days}} |
| 15 | <h3>{{.Label}}</h3> |
| 16 | <ul> |
| 17 | {{- range .Versions}} |
| 18 | <li><a mapa-ver href="{{.Href}}"{{if .Chosen}} aria-current="true"{{end}}><span mapa-ava aria-hidden="true">{{.Initial}}</span><span mapa-ver-main><b>{{.Who}}</b>{{if .Current}} <span mapa-ver-now>· current</span>{{end}}<small mapa-ver-summary>{{.Summary}}</small></span><time datetime="{{.At.Format "2006-01-02T15:04:05Z07:00"}}" title="{{stamp .At}}">{{.Time}}</time></a></li> |
| 19 | {{- end}} |
| 20 | </ul> |
| 21 | {{- else}} |
| 22 | <p mapa-history-note>No saved versions in the last 90 days.</p> |
| 23 | {{- end}} |
| 24 | {{- with .Older}} |
| 25 | <p mapa-history-more><a rst-btn href="{{.}}" data-mapa-history-older>Show older</a></p> |
| 26 | {{- end}} |
| 27 | {{- if .AgedOut}} |
| 28 | <p mapa-history-note>Earlier history has aged out.</p> |
| 29 | {{- end}} |
| 30 | {{- with .Images}} |
| 31 | <p mapa-history-note><a href="{{.}}">Images on this page</a>, earlier ones included, with Remove.</p> |
| 32 | {{- end}} |
| 33 | </div> |
| 34 | {{- if eq .State "version"}} |
| 35 | <div mapa-history-foot> |
| 36 | <a rst-btn href="{{.Close}}">Back to current</a> |
| 37 | {{- with .Restore}} |
| 38 | <form method="post" action="{{.}}"><button rst-btn="primary" type="submit">{{icon "rotate-ccw"}}Restore this version</button></form> |
| 39 | {{- end}} |
| 40 | </div> |
| 41 | {{- end}} |
| 42 | </aside>{{end}} |
| 43 | |