From 8a237e0cfea615747976d03ed1a6b1a932e5fa86 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Sun, 21 Jul 2024 17:55:51 +0200 Subject: feat: Add tar.gz link to commit page --- templates/commit.qtpl | 7 +++- templates/commit.qtpl.go | 77 ++++++++++++++++++++++++++-------------- templates/gititemcommit.qtpl | 2 +- templates/gititemcommit.qtpl.go | 2 +- templates/gititemlog.qtpl | 2 +- templates/gititemlog.qtpl.go | 2 +- templates/gititemsummary.qtpl | 2 +- templates/gititemsummary.qtpl.go | 2 +- 8 files changed, 63 insertions(+), 33 deletions(-) (limited to 'templates') diff --git a/templates/commit.qtpl b/templates/commit.qtpl index 3070172..2b58864 100644 --- a/templates/commit.qtpl +++ b/templates/commit.qtpl @@ -1,11 +1,16 @@ {% import "github.com/go-git/go-git/v5/plumbing/object" %} -{% func Commit(name string, c *object.Commit) %} +{% func Commit(name string, c *object.Commit, showTar bool) %}
+ {% if showTar %} +
+ tar.gz +
+ {% endif %} diff --git a/templates/commit.qtpl.go b/templates/commit.qtpl.go index 7f46499..04d1c9c 100644 --- a/templates/commit.qtpl.go +++ b/templates/commit.qtpl.go @@ -21,7 +21,7 @@ var ( ) //line commit.qtpl:3 -func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit) { +func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, showTar bool) { //line commit.qtpl:3 qw422016.N().S(`
@@ -45,56 +45,81 @@ func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit) { //line commit.qtpl:7 qw422016.N().S(`
+ `) +//line commit.qtpl:9 + if showTar { +//line commit.qtpl:9 + qw422016.N().S(` +
+ tar.gz +
+ `) +//line commit.qtpl:13 + } +//line commit.qtpl:13 + qw422016.N().S(`
`)
-//line commit.qtpl:14
+//line commit.qtpl:19
 	qw422016.E().S(c.Message)
-//line commit.qtpl:14
+//line commit.qtpl:19
 	qw422016.N().S(`
`) -//line commit.qtpl:17 +//line commit.qtpl:22 } -//line commit.qtpl:17 -func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit) { -//line commit.qtpl:17 +//line commit.qtpl:22 +func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit, showTar bool) { +//line commit.qtpl:22 qw422016 := qt422016.AcquireWriter(qq422016) -//line commit.qtpl:17 - StreamCommit(qw422016, name, c) -//line commit.qtpl:17 +//line commit.qtpl:22 + StreamCommit(qw422016, name, c, showTar) +//line commit.qtpl:22 qt422016.ReleaseWriter(qw422016) -//line commit.qtpl:17 +//line commit.qtpl:22 } -//line commit.qtpl:17 -func Commit(name string, c *object.Commit) string { -//line commit.qtpl:17 +//line commit.qtpl:22 +func Commit(name string, c *object.Commit, showTar bool) string { +//line commit.qtpl:22 qb422016 := qt422016.AcquireByteBuffer() -//line commit.qtpl:17 - WriteCommit(qb422016, name, c) -//line commit.qtpl:17 +//line commit.qtpl:22 + WriteCommit(qb422016, name, c, showTar) +//line commit.qtpl:22 qs422016 := string(qb422016.B) -//line commit.qtpl:17 +//line commit.qtpl:22 qt422016.ReleaseByteBuffer(qb422016) -//line commit.qtpl:17 +//line commit.qtpl:22 return qs422016 -//line commit.qtpl:17 +//line commit.qtpl:22 } diff --git a/templates/gititemcommit.qtpl b/templates/gititemcommit.qtpl index e685f23..77536f1 100644 --- a/templates/gititemcommit.qtpl +++ b/templates/gititemcommit.qtpl @@ -10,7 +10,7 @@ type GitItemCommitPage struct { {% func (g *GitItemCommitPage) GitContent(name, ref string) %}
- {%= Commit(name, g.Commit) %} + {%= Commit(name, g.Commit, true) %}