From 8f5f9ff24b0327f7640e3619de109e1f19cfba1d Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Thu, 30 May 2024 18:08:12 +0200 Subject: feat: Add git sub page --- pkg/handler/git/handler.go | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/handler/git/handler.go b/pkg/handler/git/handler.go index e088749..45cd865 100644 --- a/pkg/handler/git/handler.go +++ b/pkg/handler/git/handler.go @@ -6,6 +6,7 @@ import ( "git.gabrielgio.me/cerrado/pkg/service" "git.gabrielgio.me/cerrado/templates" + "github.com/gorilla/mux" ) type ( @@ -35,7 +36,47 @@ func (g *GitHandler) List(w http.ResponseWriter, _ *http.Request) { templates.WritePageTemplate(w, gitList) } -func (g *GitHandler) Item(w http.ResponseWriter, _ *http.Request) { - gitList := &templates.GitItemPage{} +func (g *GitHandler) Summary(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemSummaryPage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) About(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemAboutPage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) Refs(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemRefsPage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) Tree(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemTreePage{}, + } + templates.WritePageTemplate(w, gitList) +} + +func (g *GitHandler) Log(w http.ResponseWriter, r *http.Request) { + name := mux.Vars(r)["name"] + gitList := &templates.GitItemPage{ + Name: name, + GitItemBase: &templates.GitItemLogPage{}, + } templates.WritePageTemplate(w, gitList) } -- cgit v1.2.3