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.
type NiceDiff struct {
Commit struct {
Message string
Author object.Signature
This string
Parent string
Message string
Author object.Signature
This string
Parent string
PGPSignature string
}
Stat struct {
FilesChanged int
@ -86,6 +87,9 @@ func (g *GitRepo) Diff() (*NiceDiff, error) {
}
nd.Commit.Author = c.Author
nd.Commit.Message = c.Message
if c.PGPSignature != "" {
nd.Commit.PGPSignature = c.PGPSignature
}
for _, d := range diffs {
ndiff := Diff{}

View file

@ -231,8 +231,37 @@ a:hover {
padding-bottom: 0.5rem;
}
.refs strong {
padding-right: 1em;
.refs h4 {
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 {

View file

@ -11,8 +11,13 @@
{{- .commit.Message -}}
</pre>
<div class="commit-info">
{{ .commit.Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</span>
<div>{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div>
{{ .commit.Author.Name }} <a href="mailto:{{ .Author.Email }}" class="commit-email">{{ .commit.Author.Email}}</a>
<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>

View file

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