diff options
author | jan <jan@ruken.pw> | 2015-12-26 09:04:06 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2015-12-26 09:04:06 (UTC) |
commit | fb0424cea33e1c48f940c485bff1f4d0aac31dc4 (patch) | |
tree | 3feff02ecf99aab704ccf60a529627b787c3c8e9 /modules/grils | |
parent | a31b9dbddf94dba7be23fcb67b169e1fe5ffc81b (diff) |
Neue Grils für das Dashboard
Diffstat (limited to 'modules/grils')
-rw-r--r-- | modules/grils/grils.go | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/modules/grils/grils.go b/modules/grils/grils.go index 047385e..fbe57e3 100644 --- a/modules/grils/grils.go +++ b/modules/grils/grils.go | |||
@@ -2,7 +2,9 @@ package grils | |||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fagott.pw/charakterin" | 4 | "fagott.pw/charakterin" |
5 | "fagott.pw/grilist/frontend" | ||
5 | "fagott.pw/grilist/grilist" | 6 | "fagott.pw/grilist/grilist" |
7 | "fmt" | ||
6 | "github.com/julienschmidt/httprouter" | 8 | "github.com/julienschmidt/httprouter" |
7 | "net/http" | 9 | "net/http" |
8 | "strconv" | 10 | "strconv" |
@@ -27,7 +29,35 @@ func (m *GrilsModule) Interface() interface{} { | |||
27 | } | 29 | } |
28 | 30 | ||
29 | func (m *GrilsModule) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory { | 31 | func (m *GrilsModule) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory { |
30 | return []grilist.DashboardCategory{} | 32 | var categories []grilist.DashboardCategory |
33 | |||
34 | var grils []*Gril | ||
35 | |||
36 | // TODO | ||
37 | // NUR TEMPORÄR | ||
38 | g, _ := m.FromID(1) | ||
39 | grils = append(grils, g) | ||
40 | |||
41 | cat := grilist.DashboardCategory{ | ||
42 | Title: "Neue Grils", | ||
43 | } | ||
44 | |||
45 | for _, gril := range grils { | ||
46 | cat.Cards = append(cat.Cards, frontend.Card{ | ||
47 | Title: gril.RomajiName, | ||
48 | Description: gril.KanjiName, | ||
49 | Size: "medium", | ||
50 | Actions: []frontend.Action{ | ||
51 | frontend.Action{ | ||
52 | Name: "anguckieren", | ||
53 | Link: fmt.Sprintf("/gril/%d", gril.ID), | ||
54 | }, | ||
55 | }, | ||
56 | }) | ||
57 | } | ||
58 | |||
59 | categories = append(categories, cat) | ||
60 | return categories | ||
31 | } | 61 | } |
32 | 62 | ||
33 | func (m *GrilsModule) FromID(id int) (*Gril, error) { | 63 | func (m *GrilsModule) FromID(id int) (*Gril, error) { |