templates: unified repo-header
Anirudh Oppiliappan x@icyphox.sh
Sun, 18 Dec 2022 10:42:18 +0530
7 files changed,
49 insertions(+),
41 deletions(-)
M
templates/commit.html
→
templates/commit.html
@@ -2,10 +2,7 @@ {{ define "commit" }}
<html> {{ template "head" . }} - <header> - <h1>{{ .meta.Title }}</h1> - <h2>{{ .meta.Description }}</h2> - </header> + {{ template "repoheader" . }} <body> {{ template "nav" . }} <main>@@ -19,9 +16,11 @@ <p>commit: <a href="/{{ .name }}/commit/{{ .commit.This }}">
{{ .commit.This }} </a> </p> + {{ if .commit.Parent }} <p>parent: <a href="/{{ .name }}/commit/{{ .commit.Parent }}"> {{ .commit.Parent }} </a> + {{ end }} </p> <div class="diff-stat"> <div>
M
templates/file.html
→
templates/file.html
@@ -2,21 +2,22 @@ {{ define "file" }}
<html> {{ template "head" . }} - <header> - <h1>{{ .meta.Title }}</h1> - <h2>{{ .meta.Description }}</h2> - </header> + {{ template "repoheader" . }} <body> {{ template "nav" . }} <main> - <pre> -{{ range .linecount }} -<a id="#L{{ . }}" href="#{{ . }}">{{ . }}</a> -{{- end -}} - </pre> - <pre> -{{ .content }} - </pre> + <div class="file-wrapper"> + <div class="line-numbers"> + {{- range .linecount }} +<a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a> + {{- end -}} + </div> + <div> + <span></span> + <pre> + {{- .content -}} + </pre> + </div> </main> </body> </html>
M
templates/log.html
→
templates/log.html
@@ -2,10 +2,7 @@ {{ define "log" }}
<html> {{ template "head" . }} - <header> - <h1>{{ .meta.Title }}</h1> - <h2>{{ .meta.Description }}</h2> - </header> + {{ template "repoheader" . }} <body> {{ template "nav" . }} <main>
M
templates/refs.html
→
templates/refs.html
@@ -2,32 +2,39 @@ {{ define "refs" }}
<html> {{ template "head" . }} - <header> - <h1>{{ .meta.Title }}</h1> - <h2>{{ .meta.Description }}</h2> - </header> + {{ template "repoheader" . }} <body> {{ template "nav" . }} <main> - <h3>branches</h3> {{ $name := .name }} + <h3>branches</h3> + <div class="refs"> {{ range .branches }} - <p> - <strong>{{ .Name.Short }}</strong> - <a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a> - <a href="/{{ $name }}/log/{{ .Name.Short }}">log</a> - </p> + <div> + <strong>{{ .Name.Short }}</strong> + </div> + <div> + <a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a> + <a href="/{{ $name }}/log/{{ .Name.Short }}">log</a> + </div> {{ end }} + </div> {{ if .tags }} <h3>tags</h3> + <div class="refs"> {{ range .tags }} + <div> <strong>{{ .Name }}</strong> + </div> + <div> <a href="/{{ $name }}/tree/{{ .Name }}/">browse</a> <a href="/{{ $name }}/log/{{ .Name }}">log</a> {{ if .Message }} <pre>{{ .Message }}</pre> + </div> {{ end }} {{ end }} + </div> {{ end }} </main> </body>
A
templates/repo-header.html
@@ -0,0 +1,12 @@
+{{ define "repoheader" }} +<header> + <h2> + <a href="/">all repos</a> + — {{ .name }} + {{ if .ref }} + <span class="ref">@ {{ .ref }}</span> + {{ end }} + </h2> + <h3 class="desc">{{ .desc }}</h3> +</header> +{{ end }}
M
templates/repo.html
→
templates/repo.html
@@ -7,13 +7,8 @@ {{ end }}
</title> {{ template "head" . }} - <header> - <h2> - <a href="/">all repos</a> - — {{ .name }} - </h2> - <h3 class="desc">{{ .desc }}</h3> - </header> +{{ template "repoheader" . }} + <body> {{ template "nav" . }} <main>
M
templates/tree.html
→
templates/tree.html
@@ -7,10 +7,7 @@ {{ end }}
</title> {{ template "head" . }} - <header> - <h1>{{ .meta.Title }}</h1> - <h2>{{ .meta.Description }}</h2> - </header> + {{ template "repoheader" . }} <body> {{ template "nav" . }} <main>