From c582d1cd2ff9f0f642ff750c73fc04c962dc5560 Mon Sep 17 00:00:00 2001 From: rtz12 Date: Wed, 12 Oct 2016 22:49:25 +0200 Subject: Logging fuer Series und Tags eingebaut 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 DELETE_LIST EDIT_LIST CHANGE_GRIL_ORDER +VIEW_SERIES +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 { OldOrder int `json:"oldOrder"` NewOrder int `json:"newOrder"` } + +type ViewSeriesData struct { + EventLoggerData + SeriesID int `json:"seriesId"` +} + +type ViewTagData struct { + EventLoggerData + Tag string `json:"tag"` + TagID int `json:"tagId"` + Results int `json:"results"` + Pages int `json:"pages"` + Page int `json:"page"` +} 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 ( "strconv" "fagott.pw/charakterin" + "fagott.pw/grilist/eventlogging" "fagott.pw/grilist/grilist" + "github.com/julienschmidt/httprouter" ) @@ -32,13 +34,17 @@ func (m *Module) ProvideDashboardData(user *charakterin.User) []grilist.Dashboar } func (m *Module) viewSeries(w http.ResponseWriter, r *http.Request, p httprouter.Params) { - _, _ = m.g.Charakterin.GetUserFromRequest(r) + el := m.g.EventLogger(r) + user, _ := m.g.Charakterin.GetUserFromRequest(r) - _, err := strconv.Atoi(p.ByName("id")) + 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, + }) } 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 ( "strconv" "fagott.pw/charakterin" + "fagott.pw/grilist/eventlogging" "fagott.pw/grilist/frontend" "fagott.pw/grilist/grilist" "fagott.pw/grilist/modules/grils" @@ -55,6 +56,7 @@ func (m *Module) viewTag(w http.ResponseWriter, r *http.Request, p httprouter.Pa } func (m *Module) viewTagPage(w http.ResponseWriter, r *http.Request, p httprouter.Params) { + el := m.g.EventLogger(r) user, _ := m.g.Charakterin.GetUserFromRequest(r) tag := p.ByName("tag") var tagID int @@ -125,4 +127,11 @@ func (m *Module) viewTagPage(w http.ResponseWriter, r *http.Request, p httproute data["cards"] = cards data["pagination"] = frontend.PaginationFromPage(3, pageNumber, pageCount) m.g.Renderer.RenderPage("tag", w, data) + el.ViewTag(user, eventlogging.ViewTagData{ + Tag: tag, + TagID: tagID, + Results: pageNum, + Pages: pageCount, + Page: pageNumber, + }) } -- cgit v0.10.1