Migration
This is my new public git source viewer. Source coming soon. Please contact with concerns/bugs.
Contact me
templates/layouts/base.html
d658fcc4ea9f3bb562fd00dce8f863934560c56c
· 3.1 KB · 75 lines
raw
| 1 | {{ define "base" }}<!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 | <title>{{ block "title" . }}{{ with .Info.Title }}{{ . }} · {{ end }}{{ .Site.Name }}{{ end }}</title> |
| 7 | <link rel="stylesheet" href="{{ static "css/base.css" }}"> |
| 8 | {{ block "styles" . }}{{ end }} |
| 9 | </head> |
| 10 | <body> |
| 11 | {{ template "nav" . }} |
| 12 | <main class="wrap">{{ template "notices" . }}{{ block "main" . }}{{ end }}</main> |
| 13 | <footer class="wrap"> |
| 14 | <div class="footer-left"> |
| 15 | <span class="logo" style="width:24px;height:24px;font-size:0.9rem;">G</span> |
| 16 | <span>{{ .Site.Name }}</span> |
| 17 | </div> |
| 18 | <div class="footer-right"> |
| 19 | <!--<span>served from bare repositories</span> |
| 20 | <span style="color:var(--line);margin:0 .5rem;">•</span>--> |
| 21 | <span>{{ .Site.Name }} v1.3</span> |
| 22 | </div> |
| 23 | </footer> |
| 24 | {{ block "scripts" . }}{{ end }} |
| 25 | </body> |
| 26 | </html>{{ end }} |
| 27 | |
| 28 | {{ define "nav" }} |
| 29 | <nav class="nav"> |
| 30 | <div class="wrap nav-inner"> |
| 31 | <div class="nav-start"> |
| 32 | <a class="brand" href="/"> |
| 33 | <span class="logo">G</span> |
| 34 | <span>{{ .Site.Name }}</span> |
| 35 | </a> |
| 36 | {{ with .Info.Slug }} |
| 37 | <a class="repo-name nav-repo-name" href="/{{ . }}/">{{ $.Info.Title }}</a> |
| 38 | {{ end }} |
| 39 | </div> |
| 40 | {{ with .Info.Slug }} |
| 41 | <nav class="tabs"> |
| 42 | {{ range $.Nav }}<a class="tab{{ if .Active }} active{{ end }}" href="{{ .Href }}">{{ .Label }}</a>{{ end }} |
| 43 | </nav> |
| 44 | {{ end }} |
| 45 | <div class="nav-end"> |
| 46 | {{ with .Info.Slug }} |
| 47 | {{ with modOr "refs" }} |
| 48 | {{/* .Ref is a SHA (or a compare range) on commit/diff/compare pages, |
| 49 | which never matches a branch or tag name. Without a matching |
| 50 | option the browser silently selects the first branch instead, |
| 51 | which misleadingly reads as "you're on this branch". Show an |
| 52 | explicit detached entry there instead of letting that happen. */}} |
| 53 | {{ $known := false }} |
| 54 | {{ range .Branches }}{{ if eq .Name $.Ref }}{{ $known = true }}{{ end }}{{ end }} |
| 55 | {{ range .Tags }}{{ if eq .Name $.Ref }}{{ $known = true }}{{ end }}{{ end }} |
| 56 | <label class="refpicker"> |
| 57 | <span class="sr">Ref</span> |
| 58 | <select onchange="if(this.value) location.href=this.value"> |
| 59 | {{ if not $known }}<option value="" selected disabled>{{ trunc 12 $.Ref }} (detached)</option>{{ end }} |
| 60 | {{ range .Branches }}<option value="/{{ $.Info.Slug }}/tree/{{ .Name }}"{{ if eq .Name $.Ref }} selected{{ end }}>{{ .Name }}</option>{{ end }} |
| 61 | {{ range .Tags }}<option value="/{{ $.Info.Slug }}/tree/{{ .Name }}"{{ if eq .Name $.Ref }} selected{{ end }}>{{ .Name }}</option>{{ end }} |
| 62 | </select> |
| 63 | </label> |
| 64 | {{ end }} |
| 65 | {{ end }} |
| 66 | {{/* One-sided on purpose: no "log in" link when anonymous. There is |
| 67 | no discoverable entry point into /auth/login anywhere in the UI; |
| 68 | people who need it are told the URL out of band. */}} |
| 69 | {{ with $.User }} |
| 70 | <span class="nav-user">Logged in as {{ . }} · <a href="/auth/logout">log out</a></span> |
| 71 | {{ end }} |
| 72 | </div> |
| 73 | </div> |
| 74 | </nav> |
| 75 | {{ end }} |