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>
{{ template "head" . }}
<header>
<h1>{{ .meta.Title }}</h1>
<h2>{{ .meta.Description }}</h2>
</header>
{{ template "repoheader" . }}
<body>
{{ template "nav" . }}
<main>
@ -19,9 +16,11 @@
{{ .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>

View File

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

View File

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

View File

@ -2,32 +2,39 @@
<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>
<div>
<strong>{{ .Name.Short }}</strong>
</div>
<div>
<a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a>
<a href="/{{ $name }}/log/{{ .Name.Short }}">log</a>
</p>
</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>

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

View File

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