From e2d40c07c10ba46c7b32bbfbbf00493f40fe3c56 Mon Sep 17 00:00:00 2001 From: jan Date: Tue, 11 Oct 2016 16:31:52 +0200 Subject: serienmodul hinzugefuegt, die datenbank muss aber erst mal gerichtet werden diff --git a/main.go b/main.go index 9231f7c..7ee05ad 100644 --- a/main.go +++ b/main.go @@ -12,6 +12,7 @@ import ( "fagott.pw/grilist/modules/grils" "fagott.pw/grilist/modules/lists" "fagott.pw/grilist/modules/search" + "fagott.pw/grilist/modules/series" "fagott.pw/grilist/modules/tags" "fagott.pw/grilist/modules/user" @@ -87,6 +88,7 @@ func main() { loadModule(tags.New()) loadModule(search.New()) loadModule(user.New()) + loadModule(series.New()) router.GET("/dashboard", viewDashboard) log.Fatal(http.ListenAndServe(":8080", nil)) diff --git a/modules/series/module.go b/modules/series/module.go new file mode 100644 index 0000000..295e16b --- /dev/null +++ b/modules/series/module.go @@ -0,0 +1,44 @@ +package series + +import ( + "net/http" + "strconv" + + "fagott.pw/charakterin" + "fagott.pw/grilist/grilist" + "github.com/julienschmidt/httprouter" +) + +type Module struct { + g *grilist.Grilist +} + +func New() *Module { + return &Module{} +} + +func (m *Module) Name() string { + return "Series" +} + +func (m *Module) Init(g *grilist.Grilist) { + m.g = g + + m.g.Router.GET("/series/:id", m.viewSeries) +} + +func (m *Module) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory { + return make([]grilist.DashboardCategory, 0) +} + +func (m *Module) viewSeries(w http.ResponseWriter, r *http.Request, p httprouter.Params) { + _, _ = m.g.Charakterin.GetUserFromRequest(r) + + _, err := strconv.Atoi(p.ByName("id")) + if err != nil { + http.Redirect(w, r, "/", 302) + return + } + + http.Error(w, "not implemented", 500) +} -- cgit v0.10.1