diff options
Diffstat (limited to 'dashboard.go')
-rw-r--r-- | dashboard.go | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/dashboard.go b/dashboard.go index 221e923..aa6405c 100644 --- a/dashboard.go +++ b/dashboard.go | |||
@@ -1,3 +1,29 @@ | |||
1 | package main | 1 | package main |
2 | 2 | ||
3 | import () | 3 | import ( |
4 | "net/http" | ||
5 | "fagott.pw/grilist/grilist" | ||
6 | "github.com/julienschmidt/httprouter" | ||
7 | ) | ||
8 | |||
9 | func viewDashboard(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { | ||
10 | user, err := app.Charakterin.GetUserFromRequest(r) | ||
11 | if err != nil { | ||
12 | http.Redirect(w, r, "/", 302) | ||
13 | return | ||
14 | } | ||
15 | |||
16 | var categories []grilist.DashboardCategory | ||
17 | |||
18 | for _, module := range app.Modules { | ||
19 | category := module.ProvideDashboardData(user) | ||
20 | |||
21 | if len(category.Cards) > 0 { | ||
22 | categories = append(categories, category) | ||
23 | } | ||
24 | } | ||
25 | |||
26 | data := make(map[string]interface{}) | ||
27 | data["categories"] = categories | ||
28 | app.Renderer.RenderPage("dashboard", w, data) | ||
29 | } \ No newline at end of file | ||