Migration This is my new public git source viewer. Source available. Please contact with concerns/bugs. Contact me

templates/layouts/base.html

45d94aa8f6cc5c5755fd2a26096d4a3644671ec6 · 2.9 KB · 72 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 }}{{ . }} &middot; {{ 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="brand">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;">&bull;</span>-->
21 <span>{{ .Site.Name }} v1.4</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 {{ with $.User }}
67 <span class="nav-user">Logged in as {{ . }} &middot; <a href="/auth/logout">log out</a></span>
68 {{ end }}
69 </div>
70 </div>
71 </nav>
72 {{ end }}