aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go2
-rw-r--r--modules/series/module.go44
2 files changed, 46 insertions, 0 deletions
diff --git a/main.go b/main.go
index 9231f7c..7ee05ad 100644
--- a/main.go
+++ b/main.go
@@ -12,6 +12,7 @@ import (
12 "fagott.pw/grilist/modules/grils" 12 "fagott.pw/grilist/modules/grils"
13 "fagott.pw/grilist/modules/lists" 13 "fagott.pw/grilist/modules/lists"
14 "fagott.pw/grilist/modules/search" 14 "fagott.pw/grilist/modules/search"
15 "fagott.pw/grilist/modules/series"
15 "fagott.pw/grilist/modules/tags" 16 "fagott.pw/grilist/modules/tags"
16 "fagott.pw/grilist/modules/user" 17 "fagott.pw/grilist/modules/user"
17 18
@@ -87,6 +88,7 @@ func main() {
87 loadModule(tags.New()) 88 loadModule(tags.New())
88 loadModule(search.New()) 89 loadModule(search.New())
89 loadModule(user.New()) 90 loadModule(user.New())
91 loadModule(series.New())
90 router.GET("/dashboard", viewDashboard) 92 router.GET("/dashboard", viewDashboard)
91 93
92 log.Fatal(http.ListenAndServe(":8080", nil)) 94 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 @@
1package series
2
3import (
4 "net/http"
5 "strconv"
6
7 "fagott.pw/charakterin"
8 "fagott.pw/grilist/grilist"
9 "github.com/julienschmidt/httprouter"
10)
11
12type Module struct {
13 g *grilist.Grilist
14}
15
16func New() *Module {
17 return &Module{}
18}
19
20func (m *Module) Name() string {
21 return "Series"
22}
23
24func (m *Module) Init(g *grilist.Grilist) {
25 m.g = g
26
27 m.g.Router.GET("/series/:id", m.viewSeries)
28}
29
30func (m *Module) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory {
31 return make([]grilist.DashboardCategory, 0)
32}
33
34func (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}