update layout for refs page, add pgp signatures to tags and commits

only detailed commits have pgp sigs, not in the log to save bandwidth
This commit is contained in:
Iris Lightshard 2023-02-01 22:43:10 -07:00
parent 584243d358
commit cd131c0629
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
4 changed files with 71 additions and 23 deletions

View file

@ -28,10 +28,11 @@ type Diff struct {
// A nicer git diff representation. // A nicer git diff representation.
type NiceDiff struct { type NiceDiff struct {
Commit struct { Commit struct {
Message string Message string
Author object.Signature Author object.Signature
This string This string
Parent string Parent string
PGPSignature string
} }
Stat struct { Stat struct {
FilesChanged int FilesChanged int
@ -86,6 +87,9 @@ func (g *GitRepo) Diff() (*NiceDiff, error) {
} }
nd.Commit.Author = c.Author nd.Commit.Author = c.Author
nd.Commit.Message = c.Message nd.Commit.Message = c.Message
if c.PGPSignature != "" {
nd.Commit.PGPSignature = c.PGPSignature
}
for _, d := range diffs { for _, d := range diffs {
ndiff := Diff{} ndiff := Diff{}

View file

@ -231,8 +231,37 @@ a:hover {
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
} }
.refs strong { .refs h4 {
padding-right: 1em; display: inline;
}
.refs ul {
list-style: none;
display: inline;
}
.refs ul li {
margin-left: 1ch;
display: inline;
}
.tag-entry {
padding-bottom: 1em;
margin-bottom: 2em;
}
.tag-entry:not(:last-child) {
border-bottom: 1px solid var(--medium-gray);
}
.tag-entry time {
color: var(--gray);
float: right;
font-size: 0.85rem;
}
.commit time {
display: block;
} }
.line-numbers { .line-numbers {

View file

@ -11,8 +11,13 @@
{{- .commit.Message -}} {{- .commit.Message -}}
</pre> </pre>
<div class="commit-info"> <div class="commit-info">
{{ .commit.Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</span> {{ .commit.Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</a>
<div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> <time>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</time>
{{ if .commit.PGPSignature }}
<details><summary>PGP Signature</summary>
<pre>{{ .commit.PGPSignature }}</pre>
</details>
{{ end }}
</div> </div>
<div> <div>

View file

@ -12,28 +12,38 @@
<main> <main>
{{ $name := .name }} {{ $name := .name }}
<h3>branches</h3> <h3>branches</h3>
<div class="refs"> <div class="refs branches">
{{ range .branches }} {{ range .branches }}
<div> <div class="branch-entry">
<strong>{{ .Name.Short }}</strong> <h4>{{ .Name.Short }}</h4>
<a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a> <ul>
<a href="/{{ $name }}/log/{{ .Name.Short }}">log</a> <li><a href="/{{ $name }}/tree/{{ .Name.Short }}/">browse</a></li>
<li><a href="/{{ $name }}/log/{{ .Name.Short }}">log</a></li>
</ul>
</div> </div>
{{ end }} {{ end }}
</div> </div>
{{ if .tags }} {{ if .tags }}
<h3>tags</h3> <h3>tags</h3>
<div class="refs"> <div class="refs tags">
{{ range .tags }} {{ range .tags }}
<div> <div class="tag-entry">
<strong>{{ .Name }}</strong> <h4>{{ .Name }}</h4>
<a href="/{{ $name }}/tree/{{ .Name }}/">browse</a> <time>{{ .Tagger.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</time>
<a href="/{{ $name }}/log/{{ .Name }}">log</a> <ul>
{{ if .Message }} <li><a href="/{{ $name }}/tree/{{ .Name }}/">browse</a></li>
<pre>{{ .Message }}</pre> <li><a href="/{{ $name }}/log/{{ .Name }}">log</a></li>
</div> </ul>
{{ end }} {{ if .Message }}
{{ end }} <pre>{{ .Message }}</pre>
{{ end }}
{{ if .PGPSignature }}
<details><summary>PGP Signature</summary>
<pre>{{ .PGPSignature }}</pre>
</details>
{{ end }}
</div>
{{ end }}
</div> </div>
{{ end }} {{ end }}
</main> </main>