blob: aa6405c2819402a8374704e5677e8fbd2eed6373 (
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
|
package main
import (
"net/http"
"fagott.pw/grilist/grilist"
"github.com/julienschmidt/httprouter"
)
func viewDashboard(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
user, err := app.Charakterin.GetUserFromRequest(r)
if err != nil {
http.Redirect(w, r, "/", 302)
return
}
var categories []grilist.DashboardCategory
for _, module := range app.Modules {
category := module.ProvideDashboardData(user)
if len(category.Cards) > 0 {
categories = append(categories, category)
}
}
data := make(map[string]interface{})
data["categories"] = categories
app.Renderer.RenderPage("dashboard", w, data)
}
|