aboutsummaryrefslogtreecommitdiff
path: root/modules/series
diff options
context:
space:
mode:
Diffstat (limited to 'modules/series')
-rw-r--r--modules/series/module.go44
-rw-r--r--modules/series/series.go49
2 files changed, 41 insertions, 52 deletions
diff --git a/modules/series/module.go b/modules/series/module.go
deleted file mode 100644
index 295e16b..0000000
--- a/modules/series/module.go
+++ /dev/null
@@ -1,44 +0,0 @@
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}
diff --git a/modules/series/series.go b/modules/series/series.go
index 1f50903..295e16b 100644
--- a/modules/series/series.go
+++ b/modules/series/series.go
@@ -1,11 +1,44 @@
1package series 1package series
2 2
3type Series struct { 3import (
4 ID int 4 "net/http"
5 Name string 5 "strconv"
6 KanjiName string 6
7 RomajiName string 7 "fagott.pw/charakterin"
8 FuriganaName string 8 "fagott.pw/grilist/grilist"
9 OtherNames []string 9 "github.com/julienschmidt/httprouter"
10 Tags []string 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)
11} 44}