diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/series/module.go | 44 |
1 files changed, 44 insertions, 0 deletions
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 @@ | |||
| 1 | package series | ||
| 2 | |||
| 3 | import ( | ||
| 4 | "net/http" | ||
| 5 | "strconv" | ||
| 6 | |||
| 7 | "fagott.pw/charakterin" | ||
| 8 | "fagott.pw/grilist/grilist" | ||
| 9 | "github.com/julienschmidt/httprouter" | ||
| 10 | ) | ||
| 11 | |||
| 12 | type Module struct { | ||
| 13 | g *grilist.Grilist | ||
| 14 | } | ||
| 15 | |||
| 16 | func New() *Module { | ||
| 17 | return &Module{} | ||
| 18 | } | ||
| 19 | |||
| 20 | func (m *Module) Name() string { | ||
| 21 | return "Series" | ||
| 22 | } | ||
| 23 | |||
| 24 | func (m *Module) Init(g *grilist.Grilist) { | ||
| 25 | m.g = g | ||
| 26 | |||
| 27 | m.g.Router.GET("/series/:id", m.viewSeries) | ||
| 28 | } | ||
| 29 | |||
| 30 | func (m *Module) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory { | ||
| 31 | return make([]grilist.DashboardCategory, 0) | ||
| 32 | } | ||
| 33 | |||
| 34 | func (m *Module) viewSeries(w http.ResponseWriter, r *http.Request, p httprouter.Params) { | ||
| 35 | _, _ = m.g.Charakterin.GetUserFromRequest(r) | ||
| 36 | |||
| 37 | _, err := strconv.Atoi(p.ByName("id")) | ||
| 38 | if err != nil { | ||
| 39 | http.Redirect(w, r, "/", 302) | ||
| 40 | return | ||
| 41 | } | ||
| 42 | |||
| 43 | http.Error(w, "not implemented", 500) | ||
| 44 | } | ||
