all repos — legit @ e4d12fc667c9830dd5f08f827b2a70adff58a09b

web frontend for git, written in go

templates: unified repo-header
Anirudh Oppiliappan x@icyphox.sh
Sun, 18 Dec 2022 10:42:18 +0530
commit

e4d12fc667c9830dd5f08f827b2a70adff58a09b

parent

3e6a720154b70a9882af14399548e494b1d0089f

M templates/commit.htmltemplates/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.htmltemplates/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.htmltemplates/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.htmltemplates/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> + &mdash; {{ .name }} + {{ if .ref }} + <span class="ref">@ {{ .ref }}</span> + {{ end }} + </h2> + <h3 class="desc">{{ .desc }}</h3> +</header> +{{ end }}
M templates/repo.htmltemplates/repo.html

@@ -7,13 +7,8 @@ {{ end }}

</title> {{ template "head" . }} - <header> - <h2> - <a href="/">all repos</a> - &mdash; {{ .name }} - </h2> - <h3 class="desc">{{ .desc }}</h3> - </header> +{{ template "repoheader" . }} + <body> {{ template "nav" . }} <main>
M templates/tree.htmltemplates/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>