layout.html
| 1 | {{define "layout"}} |
| 2 | <!DOCTYPE html> |
| 3 | <html lang="en" {{if ne .Theme "auto"}}data-theme="{{.Theme}}"{{end}}> |
| 4 | <head> |
| 5 | <meta charset="UTF-8"> |
| 6 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 7 | <title>{{.Title}} - VidArchive</title> |
| 8 | <link rel="icon" type="image/svg+xml" href="/static/icons/logo.svg"> |
| 9 | <link rel="stylesheet" href="/static/pico.min.css"> |
| 10 | <link rel="stylesheet" href="/static/style.css"> |
| 11 | {{if .AutoRefresh}} |
| 12 | <meta http-equiv="refresh" content="{{.RefreshSec}}"> |
| 13 | {{end}} |
| 14 | </head> |
| 15 | <body> |
| 16 | <header> |
| 17 | <h1 class="brand"> |
| 18 | <svg class="brand-logo" viewBox="0 0 32 32" width="30" height="30" aria-hidden="true" focusable="false"> |
| 19 | <path fill="var(--pico-primary)" d="M6.5 6 H12 L15 9.5 H25 a3 3 0 0 1 3 3 V23.5 a3 3 0 0 1 -3 3 H7.5 a3 3 0 0 1 -3 -3 V8 a2 2 0 0 1 2 -2 Z"/> |
| 20 | <path fill="var(--pico-card-background-color)" d="M12.5 13.5 L21 18 L12.5 22.5 Z"/> |
| 21 | </svg> |
| 22 | <span>VidArchive</span> |
| 23 | </h1> |
| 24 | {{/* The login page shows no navigation: every link behind it needs the |
| 25 | session the visitor does not have yet. */}} |
| 26 | {{if ne .ActiveTab "login"}} |
| 27 | <nav> |
| 28 | <a href="/library" class="{{if eq .ActiveTab "library"}}active{{end}}">Library</a> |
| 29 | <a href="/queue" class="{{if eq .ActiveTab "queue"}}active{{end}}">Queue</a> |
| 30 | <a href="/download" class="{{if eq .ActiveTab "download"}}active{{end}}">Download</a> |
| 31 | <a href="/subscriptions" class="{{if eq .ActiveTab "subscriptions"}}active{{end}}">Subscriptions</a> |
| 32 | <a href="/settings" class="{{if eq .ActiveTab "settings"}}active{{end}}">Settings</a> |
| 33 | <form method="post" action="/logout" class="nav-signout"> |
| 34 | <button type="submit" class="small secondary">Sign out</button> |
| 35 | </form> |
| 36 | </nav> |
| 37 | {{end}} |
| 38 | </header> |
| 39 | |
| 40 | <main{{if eq .ActiveTab "login"}} class="login-main"{{end}}> |
| 41 | {{if .Flash}} |
| 42 | <div class="flash flash-{{.Flash.Kind}}" role="status" aria-live="polite">{{.Flash.Message}}</div> |
| 43 | {{end}} |
| 44 | {{.Content}} |
| 45 | </main> |
| 46 | |
| 47 | <footer> |
| 48 | <p>VidArchive - Video Archive Manager</p> |
| 49 | </footer> |
| 50 | </body> |
| 51 | </html> |
| 52 | {{end}} |
| 53 | |
| 54 | {{/* Shared prev/next links for the paginated listing pages. */}} |
| 55 | {{define "pagination"}} |
| 56 | {{if or (gt .Page 1) .HasNext}} |
| 57 | <nav class="pagination"> |
| 58 | {{/* Both sides always render, so the page label stays centred on the |
| 59 | first and last page. */}} |
| 60 | {{if gt .Page 1}}<a href="?{{.Query}}page={{.Prev}}">← Previous</a> |
| 61 | {{else}}<span class="disabled">← Previous</span>{{end}} |
| 62 | <span class="page">Page {{.Page}}</span> |
| 63 | {{if .HasNext}}<a href="?{{.Query}}page={{.Next}}">Next →</a> |
| 64 | {{else}}<span class="disabled">Next →</span>{{end}} |
| 65 | </nav> |
| 66 | {{end}} |
| 67 | {{end}} |
| 68 |