diff options
author | rtz12 <koenig@fagott.pw> | 2016-10-12 20:49:25 (UTC) |
---|---|---|
committer | rtz12 <koenig@fagott.pw> | 2016-10-12 20:49:25 (UTC) |
commit | c582d1cd2ff9f0f642ff750c73fc04c962dc5560 (patch) | |
tree | 91fa99bb6eed2af3462f892daab5b142b033fde1 | |
parent | 593659727c0b30e8806dbd622c45760865467be2 (diff) |
Logging fuer Series und Tags eingebaut
-rw-r--r-- | eventlogging/events.txt | 2 | ||||
-rw-r--r-- | eventlogging/types.go | 14 | ||||
-rw-r--r-- | modules/series/series.go | 10 | ||||
-rw-r--r-- | modules/tags/tags.go | 9 |
4 files changed, 33 insertions, 2 deletions
diff --git a/eventlogging/events.txt b/eventlogging/events.txt index 0e170dc..cf07b40 100644 --- a/eventlogging/events.txt +++ b/eventlogging/events.txt | |||
@@ -6,3 +6,5 @@ DELETE_GRIL_FROM_LIST | |||
6 | DELETE_LIST | 6 | DELETE_LIST |
7 | EDIT_LIST | 7 | EDIT_LIST |
8 | CHANGE_GRIL_ORDER | 8 | CHANGE_GRIL_ORDER |
9 | VIEW_SERIES | ||
10 | VIEW_TAG | ||
diff --git a/eventlogging/types.go b/eventlogging/types.go index a835b26..29ad89d 100644 --- a/eventlogging/types.go +++ b/eventlogging/types.go | |||
@@ -50,3 +50,17 @@ type ChangeGrilOrderData struct { | |||
50 | OldOrder int `json:"oldOrder"` | 50 | OldOrder int `json:"oldOrder"` |
51 | NewOrder int `json:"newOrder"` | 51 | NewOrder int `json:"newOrder"` |
52 | } | 52 | } |
53 | |||
54 | type ViewSeriesData struct { | ||
55 | EventLoggerData | ||
56 | SeriesID int `json:"seriesId"` | ||
57 | } | ||
58 | |||
59 | type ViewTagData struct { | ||
60 | EventLoggerData | ||
61 | Tag string `json:"tag"` | ||
62 | TagID int `json:"tagId"` | ||
63 | Results int `json:"results"` | ||
64 | Pages int `json:"pages"` | ||
65 | Page int `json:"page"` | ||
66 | } | ||
diff --git a/modules/series/series.go b/modules/series/series.go index 295e16b..c354de7 100644 --- a/modules/series/series.go +++ b/modules/series/series.go | |||
@@ -5,7 +5,9 @@ import ( | |||
5 | "strconv" | 5 | "strconv" |
6 | 6 | ||
7 | "fagott.pw/charakterin" | 7 | "fagott.pw/charakterin" |
8 | "fagott.pw/grilist/eventlogging" | ||
8 | "fagott.pw/grilist/grilist" | 9 | "fagott.pw/grilist/grilist" |
10 | |||
9 | "github.com/julienschmidt/httprouter" | 11 | "github.com/julienschmidt/httprouter" |
10 | ) | 12 | ) |
11 | 13 | ||
@@ -32,13 +34,17 @@ func (m *Module) ProvideDashboardData(user *charakterin.User) []grilist.Dashboar | |||
32 | } | 34 | } |
33 | 35 | ||
34 | func (m *Module) viewSeries(w http.ResponseWriter, r *http.Request, p httprouter.Params) { | 36 | func (m *Module) viewSeries(w http.ResponseWriter, r *http.Request, p httprouter.Params) { |
35 | _, _ = m.g.Charakterin.GetUserFromRequest(r) | 37 | el := m.g.EventLogger(r) |
38 | user, _ := m.g.Charakterin.GetUserFromRequest(r) | ||
36 | 39 | ||
37 | _, err := strconv.Atoi(p.ByName("id")) | 40 | id, err := strconv.Atoi(p.ByName("id")) |
38 | if err != nil { | 41 | if err != nil { |
39 | http.Redirect(w, r, "/", 302) | 42 | http.Redirect(w, r, "/", 302) |
40 | return | 43 | return |
41 | } | 44 | } |
42 | 45 | ||
43 | http.Error(w, "not implemented", 500) | 46 | http.Error(w, "not implemented", 500) |
47 | el.ViewSeries(user, eventlogging.ViewSeriesData{ | ||
48 | SeriesID: id, | ||
49 | }) | ||
44 | } | 50 | } |
diff --git a/modules/tags/tags.go b/modules/tags/tags.go index 4019f8a..e295b34 100644 --- a/modules/tags/tags.go +++ b/modules/tags/tags.go | |||
@@ -7,6 +7,7 @@ import ( | |||
7 | "strconv" | 7 | "strconv" |
8 | 8 | ||
9 | "fagott.pw/charakterin" | 9 | "fagott.pw/charakterin" |
10 | "fagott.pw/grilist/eventlogging" | ||
10 | "fagott.pw/grilist/frontend" | 11 | "fagott.pw/grilist/frontend" |
11 | "fagott.pw/grilist/grilist" | 12 | "fagott.pw/grilist/grilist" |
12 | "fagott.pw/grilist/modules/grils" | 13 | "fagott.pw/grilist/modules/grils" |
@@ -55,6 +56,7 @@ func (m *Module) viewTag(w http.ResponseWriter, r *http.Request, p httprouter.Pa | |||
55 | } | 56 | } |
56 | 57 | ||
57 | func (m *Module) viewTagPage(w http.ResponseWriter, r *http.Request, p httprouter.Params) { | 58 | func (m *Module) viewTagPage(w http.ResponseWriter, r *http.Request, p httprouter.Params) { |
59 | el := m.g.EventLogger(r) | ||
58 | user, _ := m.g.Charakterin.GetUserFromRequest(r) | 60 | user, _ := m.g.Charakterin.GetUserFromRequest(r) |
59 | tag := p.ByName("tag") | 61 | tag := p.ByName("tag") |
60 | var tagID int | 62 | var tagID int |
@@ -125,4 +127,11 @@ func (m *Module) viewTagPage(w http.ResponseWriter, r *http.Request, p httproute | |||
125 | data["cards"] = cards | 127 | data["cards"] = cards |
126 | data["pagination"] = frontend.PaginationFromPage(3, pageNumber, pageCount) | 128 | data["pagination"] = frontend.PaginationFromPage(3, pageNumber, pageCount) |
127 | m.g.Renderer.RenderPage("tag", w, data) | 129 | m.g.Renderer.RenderPage("tag", w, data) |
130 | el.ViewTag(user, eventlogging.ViewTagData{ | ||
131 | Tag: tag, | ||
132 | TagID: tagID, | ||
133 | Results: pageNum, | ||
134 | Pages: pageCount, | ||
135 | Page: pageNumber, | ||
136 | }) | ||
128 | } | 137 | } |