From 6006194c072dba9f65aa08c6e3be06ea8ead8910 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Tue, 25 Mar 2025 21:20:13 +0100 Subject: feat: Add ref page Now there is page more tailored to a single ref. --- pkg/handler/git/handler.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'pkg/handler/git/handler.go') diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index 034d5c2..a9be54c 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -350,6 +350,28 @@ func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) error { return nil } +func (g *GitHandler) Ref(w http.ResponseWriter, r *http.Request) error { + ext.SetHTML(w) + name := r.PathValue("name") + ref := r.PathValue("ref") + + commit, tag, err := g.gitService.GetTag(ref, name) + if err != nil { + return err + } + + gitList := &templates.GitItemPage{ + Name: name, + Ref: ref, + GitItemBase: &templates.GitItemRefPage{ + Commit: commit, + Reference: tag, + }, + } + templates.WritePageTemplate(w, gitList, r.Context()) + return nil +} + func (g *GitHandler) Commit(w http.ResponseWriter, r *http.Request) error { ext.SetHTML(w) name := r.PathValue("name") -- cgit v1.2.3