cerrado @ 8a237e0cfea615747976d03ed1a6b1a932e5fa86

feat: Add tar.gz link to commit page
  1diff --git a/README.md b/README.md
  2index d3794309eed96979fe40e92c18fc9873e02f33ad..b6eea7b400b6cf92078c001d91876b3aab87d0bf 100644
  3--- a/README.md
  4+++ b/README.md
  5@@ -23,7 +23,6 @@ To run the project you just need to do a make run.
  6 
  7 ### TODO
  8 
  9-- Add link to tar browser from commit page
 10 - Add patch to the commit page
 11 - Add log pagination
 12 - Fix submodule link on tree view
 13diff --git a/templates/commit.qtpl b/templates/commit.qtpl
 14index 307017214fafd55d950c5c810bc0e8ac60e7a74b..2b58864d816b225ff35e20c1301046d41b7bfca6 100644
 15--- a/templates/commit.qtpl
 16+++ b/templates/commit.qtpl
 17@@ -1,11 +1,16 @@
 18 {% import "github.com/go-git/go-git/v5/plumbing/object" %}
 19 
 20-{% func Commit(name string, c *object.Commit) %}
 21+{% func Commit(name string, c *object.Commit, showTar bool) %}
 22   <div class="row event">
 23     <div class="row">
 24       <div class="col-md">
 25        <a title="{%s c.Hash.String() %}" href="/{%s name %}/commit/{%s c.Hash.String() %}">{%s c.Hash.String()[0:8] %}</a>
 26       </div>
 27+      {% if showTar %}
 28+      <div class="col-md text-md-center">
 29+       <a title="tar.gz for {%s c.Hash.String() %}" href="/{%s name %}/archive/{%s c.Hash.String() %}.tar.gz">tar.gz</a>
 30+      </div>
 31+      {% endif %}
 32       <div class="col-md text-md-end">
 33        <a title="{%s c.Committer.Email %}" href="mailto:{%s c.Committer.Email %}">{%s c.Committer.Name %}</a>
 34       </div>
 35diff --git a/templates/commit.qtpl.go b/templates/commit.qtpl.go
 36index 7f4649928a5d7a7c49f91dadb008170a30dc8d12..04d1c9c1aa74769d3201657d54974bd9572672a2 100644
 37--- a/templates/commit.qtpl.go
 38+++ b/templates/commit.qtpl.go
 39@@ -21,7 +21,7 @@ 	_ = qt422016.AcquireByteBuffer
 40 )
 41 
 42 //line commit.qtpl:3
 43-func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit) {
 44+func StreamCommit(qw422016 *qt422016.Writer, name string, c *object.Commit, showTar bool) {
 45 //line commit.qtpl:3
 46 	qw422016.N().S(`
 47   <div class="row event">
 48@@ -45,56 +45,81 @@ 	qw422016.E().S(c.Hash.String()[0:8])
 49 //line commit.qtpl:7
 50 	qw422016.N().S(`</a>
 51       </div>
 52+      `)
 53+//line commit.qtpl:9
 54+	if showTar {
 55+//line commit.qtpl:9
 56+		qw422016.N().S(`
 57+      <div class="col-md text-md-center">
 58+       <a title="tar.gz for `)
 59+//line commit.qtpl:11
 60+		qw422016.E().S(c.Hash.String())
 61+//line commit.qtpl:11
 62+		qw422016.N().S(`" href="/`)
 63+//line commit.qtpl:11
 64+		qw422016.E().S(name)
 65+//line commit.qtpl:11
 66+		qw422016.N().S(`/archive/`)
 67+//line commit.qtpl:11
 68+		qw422016.E().S(c.Hash.String())
 69+//line commit.qtpl:11
 70+		qw422016.N().S(`.tar.gz">tar.gz</a>
 71+      </div>
 72+      `)
 73+//line commit.qtpl:13
 74+	}
 75+//line commit.qtpl:13
 76+	qw422016.N().S(`
 77       <div class="col-md text-md-end">
 78        <a title="`)
 79-//line commit.qtpl:10
 80+//line commit.qtpl:15
 81 	qw422016.E().S(c.Committer.Email)
 82-//line commit.qtpl:10
 83+//line commit.qtpl:15
 84 	qw422016.N().S(`" href="mailto:`)
 85-//line commit.qtpl:10
 86+//line commit.qtpl:15
 87 	qw422016.E().S(c.Committer.Email)
 88-//line commit.qtpl:10
 89+//line commit.qtpl:15
 90 	qw422016.N().S(`">`)
 91-//line commit.qtpl:10
 92+//line commit.qtpl:15
 93 	qw422016.E().S(c.Committer.Name)
 94-//line commit.qtpl:10
 95+//line commit.qtpl:15
 96 	qw422016.N().S(`</a>
 97       </div>
 98     </div>
 99     <div class="code-view">
100      <pre>`)
101-//line commit.qtpl:14
102+//line commit.qtpl:19
103 	qw422016.E().S(c.Message)
104-//line commit.qtpl:14
105+//line commit.qtpl:19
106 	qw422016.N().S(`</pre>
107     </div>
108   </div>
109 `)
110-//line commit.qtpl:17
111+//line commit.qtpl:22
112 }
113 
114-//line commit.qtpl:17
115-func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit) {
116-//line commit.qtpl:17
117+//line commit.qtpl:22
118+func WriteCommit(qq422016 qtio422016.Writer, name string, c *object.Commit, showTar bool) {
119+//line commit.qtpl:22
120 	qw422016 := qt422016.AcquireWriter(qq422016)
121-//line commit.qtpl:17
122-	StreamCommit(qw422016, name, c)
123-//line commit.qtpl:17
124+//line commit.qtpl:22
125+	StreamCommit(qw422016, name, c, showTar)
126+//line commit.qtpl:22
127 	qt422016.ReleaseWriter(qw422016)
128-//line commit.qtpl:17
129+//line commit.qtpl:22
130 }
131 
132-//line commit.qtpl:17
133-func Commit(name string, c *object.Commit) string {
134-//line commit.qtpl:17
135+//line commit.qtpl:22
136+func Commit(name string, c *object.Commit, showTar bool) string {
137+//line commit.qtpl:22
138 	qb422016 := qt422016.AcquireByteBuffer()
139-//line commit.qtpl:17
140-	WriteCommit(qb422016, name, c)
141-//line commit.qtpl:17
142+//line commit.qtpl:22
143+	WriteCommit(qb422016, name, c, showTar)
144+//line commit.qtpl:22
145 	qs422016 := string(qb422016.B)
146-//line commit.qtpl:17
147+//line commit.qtpl:22
148 	qt422016.ReleaseByteBuffer(qb422016)
149-//line commit.qtpl:17
150+//line commit.qtpl:22
151 	return qs422016
152-//line commit.qtpl:17
153+//line commit.qtpl:22
154 }
155diff --git a/templates/gititemcommit.qtpl b/templates/gititemcommit.qtpl
156index e685f23d3e39c7ac8b44f8291617624c97f9cf92..77536f1d45da568c3317b42096a8628367beb5ac 100644
157--- a/templates/gititemcommit.qtpl
158+++ b/templates/gititemcommit.qtpl
159@@ -10,7 +10,7 @@ {% func (g *GitItemCommitPage) Nav(name, ref string) %}{%= GitItemNav(name, ref, Log) %}{% endfunc %}
160 
161 {% func (g *GitItemCommitPage) GitContent(name, ref string) %}
162 <div class="event-list">
163-  {%= Commit(name, g.Commit) %}
164+  {%= Commit(name, g.Commit, true) %}
165 </div>
166 
167 <div class="alert alert-info text-center" role="alert">
168diff --git a/templates/gititemcommit.qtpl.go b/templates/gititemcommit.qtpl.go
169index 13c1fa9ae3b12dc697d47280e043e8489b8c83cf..f94a1c2847b72a3a8b92fac0139b465c364671d3 100644
170--- a/templates/gititemcommit.qtpl.go
171+++ b/templates/gititemcommit.qtpl.go
172@@ -65,7 +65,7 @@ 	qw422016.N().S(`
173 <div class="event-list">
174   `)
175 //line gititemcommit.qtpl:13
176-	StreamCommit(qw422016, name, g.Commit)
177+	StreamCommit(qw422016, name, g.Commit, true)
178 //line gititemcommit.qtpl:13
179 	qw422016.N().S(`
180 </div>
181diff --git a/templates/gititemlog.qtpl b/templates/gititemlog.qtpl
182index ee3841c25c6d12058955b1e3054f64cf2801837a..e5bfc1b7f2e76c0fa7e666fd480f03e20bb7bad6 100644
183--- a/templates/gititemlog.qtpl
184+++ b/templates/gititemlog.qtpl
185@@ -11,7 +11,7 @@
186 {% func (g *GitItemLogPage) GitContent(name, ref string) %}
187 <div class="event-list">
188   {% for _, c := range g.Commits %}
189-  {%= Commit(name, c) %}
190+  {%= Commit(name, c, false) %}
191   {% endfor %}
192 </div>
193 {% endfunc %}
194diff --git a/templates/gititemlog.qtpl.go b/templates/gititemlog.qtpl.go
195index da8167aaed77dad2b6c6ea84a38e77ea9415f284..bb37a0815d9e9b4287a17fb160a66dc06a977778 100644
196--- a/templates/gititemlog.qtpl.go
197+++ b/templates/gititemlog.qtpl.go
198@@ -70,7 +70,7 @@ //line gititemlog.qtpl:13
199 		qw422016.N().S(`
200   `)
201 //line gititemlog.qtpl:14
202-		StreamCommit(qw422016, name, c)
203+		StreamCommit(qw422016, name, c, false)
204 //line gititemlog.qtpl:14
205 		qw422016.N().S(`
206   `)
207diff --git a/templates/gititemsummary.qtpl b/templates/gititemsummary.qtpl
208index 44e160474b48574d3c93773fa3780a17529aa480..f2de5bed534fddcf8bd529a36b06b9e2d1f15755 100644
209--- a/templates/gititemsummary.qtpl
210+++ b/templates/gititemsummary.qtpl
211@@ -39,7 +39,7 @@ </div>
212 <div class="row">
213   <div class="event-list">
214     {% for _, c := range g.Commits %}
215-    {%= Commit(name, c) %}
216+    {%= Commit(name, c, false) %}
217     {% endfor %}
218   </div>
219 </div>
220diff --git a/templates/gititemsummary.qtpl.go b/templates/gititemsummary.qtpl.go
221index 24fed9df74108f464aa3b1685e1fa597559620fc..d70823eb4c78c511c1ab9e775224170a12a22d93 100644
222--- a/templates/gititemsummary.qtpl.go
223+++ b/templates/gititemsummary.qtpl.go
224@@ -142,7 +142,7 @@ //line gititemsummary.qtpl:41
225 		qw422016.N().S(`
226     `)
227 //line gititemsummary.qtpl:42
228-		StreamCommit(qw422016, name, c)
229+		StreamCommit(qw422016, name, c, false)
230 //line gititemsummary.qtpl:42
231 		qw422016.N().S(`
232     `)