aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-07-21 17:55:51 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-07-21 17:56:27 +0200
commit8a237e0cfea615747976d03ed1a6b1a932e5fa86 (patch)
tree6fc4eb3159d502aa3a83b3ea3ea6a2b7bad2955a
parent64d9bcc4e567a0f816a0388bf740baa4c01d2323 (diff)
downloadcerrado-0.0.13.tar.gz
cerrado-0.0.13.tar.bz2
cerrado-0.0.13.zip
feat: Add tar.gz link to commit pagev0.0.13
-rw-r--r--README.md1
-rw-r--r--templates/commit.qtpl7
-rw-r--r--templates/commit.qtpl.go77
-rw-r--r--templates/gititemcommit.qtpl2
-rw-r--r--templates/gititemcommit.qtpl.go2
-rw-r--r--templates/gititemlog.qtpl2
-rw-r--r--templates/gititemlog.qtpl.go2
-rw-r--r--templates/gititemsummary.qtpl2
-rw-r--r--templates/gititemsummary.qtpl.go2
9 files changed, 63 insertions, 34 deletions
diff --git a/README.md b/README.md
index d379430..b6eea7b 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,6 @@ To run the project you just need to do a make run.
### TODO
-- Add link to tar browser from commit page
- Add patch to the commit page
- Add log pagination
- Fix submodule link on tree view
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) %}
<div class="row event">
<div class="row">
<div class="col-md">
<a title="{%s c.Hash.String() %}" href="/{%s name %}/commit/{%s c.Hash.String() %}">{%s c.Hash.String()[0:8] %}</a>
</div>
+ {% if showTar %}
+ <div class="col-md text-md-center">
+ <a title="tar.gz for {%s c.Hash.String() %}" href="/{%s name %}/archive/{%s c.Hash.String() %}.tar.gz">tar.gz</a>
+ </div>
+ {% endif %}
<div class="col-md text-md-end">
<a title="{%s c.Committer.Email %}" href="mailto:{%s c.Committer.Email %}">{%s c.Committer.Name %}</a>
</div>
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(`
<div class="row event">
@@ -45,56 +45,81 @@ func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit) {
//line commit.qtpl:7
qw422016.N().S(`</a>
</div>
+ `)
+//line commit.qtpl:9
+ if showTar {
+//line commit.qtpl:9
+ qw422016.N().S(`
+ <div class="col-md text-md-center">
+ <a title="tar.gz for `)
+//line commit.qtpl:11
+ qw422016.E().S(c.Hash.String())
+//line commit.qtpl:11
+ qw422016.N().S(`" href="/`)
+//line commit.qtpl:11
+ qw422016.E().S(name)
+//line commit.qtpl:11
+ qw422016.N().S(`/archive/`)
+//line commit.qtpl:11
+ qw422016.E().S(c.Hash.String())
+//line commit.qtpl:11
+ qw422016.N().S(`.tar.gz">tar.gz</a>
+ </div>
+ `)
+//line commit.qtpl:13
+ }
+//line commit.qtpl:13
+ qw422016.N().S(`
<div class="col-md text-md-end">
<a title="`)
-//line commit.qtpl:10
+//line commit.qtpl:15
qw422016.E().S(c.Committer.Email)
-//line commit.qtpl:10
+//line commit.qtpl:15
qw422016.N().S(`" href="mailto:`)
-//line commit.qtpl:10
+//line commit.qtpl:15
qw422016.E().S(c.Committer.Email)
-//line commit.qtpl:10
+//line commit.qtpl:15
qw422016.N().S(`">`)
-//line commit.qtpl:10
+//line commit.qtpl:15
qw422016.E().S(c.Committer.Name)
-//line commit.qtpl:10
+//line commit.qtpl:15
qw422016.N().S(`</a>
</div>
</div>
<div class="code-view">
<pre>`)
-//line commit.qtpl:14
+//line commit.qtpl:19
qw422016.E().S(c.Message)
-//line commit.qtpl:14
+//line commit.qtpl:19
qw422016.N().S(`</pre>
</div>
</div>
`)
-//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) %}
<div class="event-list">
- {%= Commit(name, g.Commit) %}
+ {%= Commit(name, g.Commit, true) %}
</div>
<div class="alert alert-info text-center" role="alert">
diff --git a/templates/gititemcommit.qtpl.go b/templates/gititemcommit.qtpl.go
index 13c1fa9..f94a1c2 100644
--- a/templates/gititemcommit.qtpl.go
+++ b/templates/gititemcommit.qtpl.go
@@ -65,7 +65,7 @@ func (g *GitItemCommitPage) StreamGitContent(qw422016 *qt422016.Writer, name, re
<div class="event-list">
`)
//line gititemcommit.qtpl:13
- StreamCommit(qw422016, name, g.Commit)
+ StreamCommit(qw422016, name, g.Commit, true)
//line gititemcommit.qtpl:13
qw422016.N().S(`
</div>
diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl
index ee3841c..e5bfc1b 100644
--- a/templates/gititemlog.qtpl
+++ b/templates/gititemlog.qtpl
@@ -11,7 +11,7 @@ type GitItemLogPage struct {
{% func (g *GitItemLogPage) GitContent(name, ref string) %}
<div class="event-list">
{% for _, c := range g.Commits %}
- {%= Commit(name, c) %}
+ {%= Commit(name, c, false) %}
{% endfor %}
</div>
{% endfunc %}
diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go
index da8167a..bb37a08 100644
--- a/templates/gititemlog.qtpl.go
+++ b/templates/gititemlog.qtpl.go
@@ -70,7 +70,7 @@ func (g *GitItemLogPage) StreamGitContent(qw422016 *qt422016.Writer, name, ref s
qw422016.N().S(`
`)
//line gititemlog.qtpl:14
- StreamCommit(qw422016, name, c)
+ StreamCommit(qw422016, name, c, false)
//line gititemlog.qtpl:14
qw422016.N().S(`
`)
diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl
index 44e1604..f2de5be 100644
--- a/templates/gititemsummary.qtpl
+++ b/templates/gititemsummary.qtpl
@@ -39,7 +39,7 @@ type GitItemSummaryPage struct {
<div class="row">
<div class="event-list">
{% for _, c := range g.Commits %}
- {%= Commit(name, c) %}
+ {%= Commit(name, c, false) %}
{% endfor %}
</div>
</div>
diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go
index 24fed9d..d70823e 100644
--- a/templates/gititemsummary.qtpl.go
+++ b/templates/gititemsummary.qtpl.go
@@ -142,7 +142,7 @@ func (g *GitItemSummaryPage) StreamGitContent(qw422016 *qt422016.Writer, name, r
qw422016.N().S(`
`)
//line gititemsummary.qtpl:42
- StreamCommit(qw422016, name, c)
+ StreamCommit(qw422016, name, c, false)
//line gititemsummary.qtpl:42
qw422016.N().S(`
`)