diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-05-30 18:08:12 +0200 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-05-30 18:08:12 +0200 |
commit | 8f5f9ff24b0327f7640e3619de109e1f19cfba1d (patch) | |
tree | 693e669355c00ed2445da34f4032bfd60abdbbe8 /pkg | |
parent | fb45f1f5002ffdb40150333c5a48458b801f3022 (diff) | |
download | cerrado-8f5f9ff24b0327f7640e3619de109e1f19cfba1d.tar.gz cerrado-8f5f9ff24b0327f7640e3619de109e1f19cfba1d.tar.bz2 cerrado-8f5f9ff24b0327f7640e3619de109e1f19cfba1d.zip |
feat: Add git sub page
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/handler/git/handler.go | 45 |
1 files changed, 43 insertions, 2 deletions
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) } |