templates: unified repo-header

This commit is contained in:
Anirudh Oppiliappan 2022-12-18 10:42:18 +05:30
parent 3e6a720154
commit e4d12fc667
No known key found for this signature in database
GPG Key ID: 8A93F96F78C5D4C4
7 changed files with 49 additions and 41 deletions

View File

@ -2,10 +2,7 @@
<html> <html>
{{ template "head" . }} {{ template "head" . }}
<header> {{ template "repoheader" . }}
<h1>{{ .meta.Title }}</h1>
<h2>{{ .meta.Description }}</h2>
</header>
<body> <body>
{{ template "nav" . }} {{ template "nav" . }}
<main> <main>
@ -19,9 +16,11 @@
{{ .commit.This }} {{ .commit.This }}
</a> </a>
</p> </p>
{{ if .commit.Parent }}
<p>parent: <a href="/{{ .name }}/commit/{{ .commit.Parent }}"> <p>parent: <a href="/{{ .name }}/commit/{{ .commit.Parent }}">
{{ .commit.Parent }} {{ .commit.Parent }}
</a> </a>
{{ end }}
</p> </p>
<div class="diff-stat"> <div class="diff-stat">
<div> <div>

View File

@ -2,21 +2,22 @@
<html> <html>
{{ template "head" . }} {{ template "head" . }}
<header> {{ template "repoheader" . }}
<h1>{{ .meta.Title }}</h1>
<h2>{{ .meta.Description }}</h2>
</header>
<body> <body>
{{ template "nav" . }} {{ template "nav" . }}
<main> <main>
<div class="file-wrapper">
<div class="line-numbers">
{{- range .linecount }}
<a id="L{{ . }}" href="#L{{ . }}">{{ . }}</a>
{{- end -}}
</div>
<div>
<span></span>
<pre> <pre>
{{ range .linecount }} {{- .content -}}
<a id="#L{{ . }}" href="#{{ . }}">{{ . }}</a>
{{- end -}}
</pre>
<pre>
{{ .content }}
</pre> </pre>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -2,10 +2,7 @@
<html> <html>
{{ template "head" . }} {{ template "head" . }}
<header> {{ template "repoheader" . }}
<h1>{{ .meta.Title }}</h1>
<h2>{{ .meta.Description }}</h2>
</header>
<body> <body>
{{ template "nav" . }} {{ template "nav" . }}
<main> <main>

View File

@ -2,32 +2,39 @@
<html> <html>
{{ template "head" . }} {{ template "head" . }}
<header> {{ template "repoheader" . }}
<h1>{{ .meta.Title }}</h1>
<h2>{{ .meta.Description }}</h2>
</header>
<body> <body>
{{ template "nav" . }} {{ template "nav" . }}
<main> <main>
<h3>branches</h3>
{{ $name := .name }} {{ $name := .name }}
<h3>branches</h3>
<div class="refs">
{{ range .branches }} {{ range .branches }}
<p> <div>
<strong>{{ .Name.Short }}</strong> <strong>{{ .Name.Short }}</strong>
</div>
<div>
<a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a> <a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a>
<a href="/{{ $name }}/log/{{ .Name.Short }}">log</a> <a href="/{{ $name }}/log/{{ .Name.Short }}">log</a>
</p> </div>
{{ end }} {{ end }}
</div>
{{ if .tags }} {{ if .tags }}
<h3>tags</h3> <h3>tags</h3>
<div class="refs">
{{ range .tags }} {{ range .tags }}
<div>
<strong>{{ .Name }}</strong> <strong>{{ .Name }}</strong>
</div>
<div>
<a href="/{{ $name }}/tree/{{ .Name }}/">browse</a> <a href="/{{ $name }}/tree/{{ .Name }}/">browse</a>
<a href="/{{ $name }}/log/{{ .Name }}">log</a> <a href="/{{ $name }}/log/{{ .Name }}">log</a>
{{ if .Message }} {{ if .Message }}
<pre>{{ .Message }}</pre> <pre>{{ .Message }}</pre>
</div>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div>
{{ end }} {{ end }}
</main> </main>
</body> </body>

View File

@ -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 }}

View File

@ -7,13 +7,8 @@
</title> </title>
{{ template "head" . }} {{ template "head" . }}
<header> {{ template "repoheader" . }}
<h2>
<a href="/">all repos</a>
&mdash; {{ .name }}
</h2>
<h3 class="desc">{{ .desc }}</h3>
</header>
<body> <body>
{{ template "nav" . }} {{ template "nav" . }}
<main> <main>

View File

@ -7,10 +7,7 @@
</title> </title>
{{ template "head" . }} {{ template "head" . }}
<header> {{ template "repoheader" . }}
<h1>{{ .meta.Title }}</h1>
<h2>{{ .meta.Description }}</h2>
</header>
<body> <body>
{{ template "nav" . }} {{ template "nav" . }}
<main> <main>