diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-02-08 22:07:17 +0100 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2025-02-08 22:07:17 +0100 |
commit | b9bfb5a86e364838355c99402977fff38db24285 (patch) | |
tree | 63af4032b18436cd180b9255ef32e1ce5747be1a /templates/commit.qtpl.go | |
parent | 178c7159af429496ac5e14b59f0822febe408760 (diff) | |
download | cerrado-b9bfb5a86e364838355c99402977fff38db24285.tar.gz cerrado-b9bfb5a86e364838355c99402977fff38db24285.tar.bz2 cerrado-b9bfb5a86e364838355c99402977fff38db24285.zip |
feat: Add time to commit logs
Diffstat (limited to 'templates/commit.qtpl.go')
-rw-r--r-- | templates/commit.qtpl.go | 108 |
1 files changed, 60 insertions, 48 deletions
diff --git a/templates/commit.qtpl.go b/templates/commit.qtpl.go index ea8f020..eeaa1f0 100644 --- a/templates/commit.qtpl.go +++ b/templates/commit.qtpl.go @@ -5,121 +5,133 @@ package templates //line templates/commit.qtpl:1 +import "git.gabrielgio.me/cerrado/pkg/humanize" + +//line templates/commit.qtpl:2 import "github.com/go-git/go-git/v5/plumbing/object" -//line templates/commit.qtpl:3 +//line templates/commit.qtpl:4 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line templates/commit.qtpl:3 +//line templates/commit.qtpl:4 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line templates/commit.qtpl:3 +//line templates/commit.qtpl:4 func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, showTar bool) { -//line templates/commit.qtpl:3 +//line templates/commit.qtpl:4 qw422016.N().S(` <div class="row event"> <div class="row"> <div class="col-md"> <a title="`) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.E().S(c.Hash.String()) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.N().S(`" href="/`) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.E().S(name) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.N().S(`/commit/`) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.E().S(c.Hash.String()) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.N().S(`/">`) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 qw422016.E().S(c.Hash.String()[0:8]) -//line templates/commit.qtpl:7 +//line templates/commit.qtpl:8 + qw422016.N().S(`</a> — + <a title="`) +//line templates/commit.qtpl:9 + qw422016.E().S(c.Committer.Email) +//line templates/commit.qtpl:9 + qw422016.N().S(`" href="mailto:`) +//line templates/commit.qtpl:9 + qw422016.E().S(c.Author.Email) +//line templates/commit.qtpl:9 + qw422016.N().S(`">`) +//line templates/commit.qtpl:9 + qw422016.E().S(c.Author.Name) +//line templates/commit.qtpl:9 qw422016.N().S(`</a> </div> `) -//line templates/commit.qtpl:9 +//line templates/commit.qtpl:11 if showTar { -//line templates/commit.qtpl:9 +//line templates/commit.qtpl:11 qw422016.N().S(` <div class="col-md text-md-center"> <a title="tar.gz for `) -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:13 qw422016.E().S(c.Hash.String()) -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:13 qw422016.N().S(`" href="/`) -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:13 qw422016.E().S(name) -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:13 qw422016.N().S(`/archive/`) -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:13 qw422016.E().S(c.Hash.String()) -//line templates/commit.qtpl:11 +//line templates/commit.qtpl:13 qw422016.N().S(`.tar.gz">tar.gz</a> </div> `) -//line templates/commit.qtpl:13 +//line templates/commit.qtpl:15 } -//line templates/commit.qtpl:13 +//line templates/commit.qtpl:15 qw422016.N().S(` <div class="col-md text-md-end"> - <a title="`) -//line templates/commit.qtpl:15 - qw422016.E().S(c.Committer.Email) -//line templates/commit.qtpl:15 - qw422016.N().S(`" href="mailto:`) -//line templates/commit.qtpl:15 - qw422016.E().S(c.Author.Email) -//line templates/commit.qtpl:15 + <a title="`) +//line templates/commit.qtpl:17 + qw422016.E().S(c.Author.When.Format("2006-01-02 15:04:05 UTC")) +//line templates/commit.qtpl:17 qw422016.N().S(`">`) -//line templates/commit.qtpl:15 - qw422016.E().S(c.Author.Name) -//line templates/commit.qtpl:15 +//line templates/commit.qtpl:17 + qw422016.E().S(humanize.Time(c.Author.When)) +//line templates/commit.qtpl:17 qw422016.N().S(`</a> </div> </div> <div class="code-view"> <pre>`) -//line templates/commit.qtpl:19 +//line templates/commit.qtpl:21 qw422016.E().S(c.Message) -//line templates/commit.qtpl:19 +//line templates/commit.qtpl:21 qw422016.N().S(`</pre> </div> </div> `) -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 } -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit, showTar bool) { -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 StreamCommit(qw422016, name, c, showTar) -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 qt422016.ReleaseWriter(qw422016) -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 } -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 func Commit(name string, c *object.Commit, showTar bool) string { -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 qb422016 := qt422016.AcquireByteBuffer() -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 WriteCommit(qb422016, name, c, showTar) -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 qs422016 := string(qb422016.B) -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 qt422016.ReleaseByteBuffer(qb422016) -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 return qs422016 -//line templates/commit.qtpl:22 +//line templates/commit.qtpl:24 } |