From cd131c06293f87b5749a50a227f470e79cc55549 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Wed, 1 Feb 2023 22:43:10 -0700 Subject: [PATCH] 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 --- git/diff.go | 12 ++++++++---- static/style.css | 33 +++++++++++++++++++++++++++++++-- templates/commit.html | 9 +++++++-- templates/refs.html | 40 +++++++++++++++++++++++++--------------- 4 files changed, 71 insertions(+), 23 deletions(-) diff --git a/git/diff.go b/git/diff.go index 93c823a..8531f57 100644 --- a/git/diff.go +++ b/git/diff.go @@ -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{} diff --git a/static/style.css b/static/style.css index 00755f8..2bcf92a 100644 --- a/static/style.css +++ b/static/style.css @@ -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 { diff --git a/templates/commit.html b/templates/commit.html index 4a01b77..656c097 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -11,8 +11,13 @@ {{- .commit.Message -}}
- {{ .commit.Author.Name }} {{ .commit.Author.Email}} -
{{ .commit.Author.When.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
+ {{ .commit.Author.Name }}
{{ .commit.Author.Email}} + + {{ if .commit.PGPSignature }} +
PGP Signature +
{{ .commit.PGPSignature }}
+
+ {{ end }}
diff --git a/templates/refs.html b/templates/refs.html index 8480856..99e69f5 100644 --- a/templates/refs.html +++ b/templates/refs.html @@ -12,28 +12,38 @@
{{ $name := .name }}

branches

-
+
{{ range .branches }} -
- {{ .Name.Short }} - browse - log +
+

{{ .Name.Short }}

+
{{ end }}
{{ if .tags }}

tags

-
+
{{ range .tags }} -
- {{ .Name }} - browse - log - {{ if .Message }} -
{{ .Message }}
-
- {{ end }} - {{ end }} +
+

{{ .Name }}

+ + + {{ if .Message }} +
{{ .Message }}
+ {{ end }} + {{ if .PGPSignature }} +
PGP Signature +
{{ .PGPSignature }}
+
+ {{ end }} +
+ {{ end }}
{{ end }}