blob: c354de7a02e901b38fa9c612e6c64e0c2ba6c5df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package series
import (
"net/http"
"strconv"
"fagott.pw/charakterin"
"fagott.pw/grilist/eventlogging"
"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) {
el := m.g.EventLogger(r)
user, _ := m.g.Charakterin.GetUserFromRequest(r)
id, err := strconv.Atoi(p.ByName("id"))
if err != nil {
http.Redirect(w, r, "/", 302)
return
}
http.Error(w, "not implemented", 500)
el.ViewSeries(user, eventlogging.ViewSeriesData{
SeriesID: id,
})
}
|