diff options
Diffstat (limited to 'pkg/handler/git/handler.go')
-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) } |