blob: 6e81d6b4b033e00a15d4c2a808ac83e61a20a3a7 (
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 (
"fagott.pw/grilist/grilist"
"github.com/julienschmidt/httprouter"
"net/http"
)
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 {
for _, category := range 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)
}
|