From 77f5ad1047dc2ae72cd616dc2acc839ea38d881f Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Thu, 6 Feb 2025 22:56:46 +0100 Subject: feat: Add last commit information --- templates/gitlist.qtpl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'templates/gitlist.qtpl') diff --git a/templates/gitlist.qtpl b/templates/gitlist.qtpl index fc047eb..4f25fc6 100644 --- a/templates/gitlist.qtpl +++ b/templates/gitlist.qtpl @@ -1,5 +1,6 @@ {% import "git.gabrielgio.me/cerrado/pkg/service" %} {% import "context" %} +{% import "strings" %} {% code type GitListPage struct { @@ -8,6 +9,16 @@ type GitListPage struct { } %} + +{% code func firstLine(text string) string { + lines := strings.Split(text, "\n") + if len(lines) > 0 { + return lines[0] + } + return "" +} +%} + {% func (p *GitListPage) Title(ctx context.Context) %}Git | List{% endfunc %} {% func (p *GitListPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Git) %}{% endfunc %} @@ -28,6 +39,10 @@ type GitListPage struct {

{%s r.Description %}

+

+ {%s r.LastCommit.Hash.String()[0:8] %} - + {%s r.LastCommit.Author.Name %} - + {%s firstLine(r.LastCommit.Message) %}

log tree -- cgit v1.2.3