diff options
-rw-r--r-- | assets_src/css/materialize_extend.css | 20 | ||||
-rw-r--r-- | frontend/renderer.go | 1 | ||||
-rw-r--r-- | modules/lists/lists.go | 6 | ||||
-rw-r--r-- | views/includes/card.html | 6 | ||||
-rw-r--r-- | views/pages/dashboard.html | 2 |
5 files changed, 29 insertions, 6 deletions
diff --git a/assets_src/css/materialize_extend.css b/assets_src/css/materialize_extend.css index f06d042..46f92ee 100644 --- a/assets_src/css/materialize_extend.css +++ b/assets_src/css/materialize_extend.css | |||
@@ -1,3 +1,23 @@ | |||
1 | span.badge.new.no-caption::after { | 1 | span.badge.new.no-caption::after { |
2 | content: ""; | 2 | content: ""; |
3 | } | 3 | } |
4 | |||
5 | /* some flexy flexbox stuff */ | ||
6 | .flex { | ||
7 | display: flex; | ||
8 | flex-direction: row; | ||
9 | flex-wrap: wrap; | ||
10 | align-items: stretch; | ||
11 | } | ||
12 | |||
13 | .flex .flex-card { | ||
14 | display: flex; | ||
15 | margin-right: 16px; | ||
16 | max-width: 400px; | ||
17 | } | ||
18 | |||
19 | .flex .flex-card .card { | ||
20 | display: flex; | ||
21 | flex-direction: column; | ||
22 | justify-content: space-between; | ||
23 | } | ||
diff --git a/frontend/renderer.go b/frontend/renderer.go index 7d3a161..6fada60 100644 --- a/frontend/renderer.go +++ b/frontend/renderer.go | |||
@@ -19,6 +19,7 @@ type Action struct { | |||
19 | // Card ist eine Karte im Materialize-Design. | 19 | // Card ist eine Karte im Materialize-Design. |
20 | type Card struct { | 20 | type Card struct { |
21 | Title string | 21 | Title string |
22 | SubTitle *string | ||
22 | Image string | 23 | Image string |
23 | Description string | 24 | Description string |
24 | Size string | 25 | Size string |
diff --git a/modules/lists/lists.go b/modules/lists/lists.go index ada4c4b..94d485e 100644 --- a/modules/lists/lists.go +++ b/modules/lists/lists.go | |||
@@ -84,6 +84,7 @@ func (m *Module) getListGrils(list *models.List) error { | |||
84 | defer rows.Close() | 84 | defer rows.Close() |
85 | list.Grils = list.Grils[:0] | 85 | list.Grils = list.Grils[:0] |
86 | var ids []int | 86 | var ids []int |
87 | grilMap := make(map[int]*models.ListGril) | ||
87 | for rows.Next() { | 88 | for rows.Next() { |
88 | var grilID int | 89 | var grilID int |
89 | lg := &models.ListGril{} | 90 | lg := &models.ListGril{} |
@@ -93,6 +94,7 @@ func (m *Module) getListGrils(list *models.List) error { | |||
93 | continue | 94 | continue |
94 | } | 95 | } |
95 | ids = append(ids, grilID) | 96 | ids = append(ids, grilID) |
97 | grilMap[grilID] = lg | ||
96 | 98 | ||
97 | list.Grils = append(list.Grils, lg) | 99 | list.Grils = append(list.Grils, lg) |
98 | } | 100 | } |
@@ -103,8 +105,8 @@ func (m *Module) getListGrils(list *models.List) error { | |||
103 | return err | 105 | return err |
104 | } | 106 | } |
105 | 107 | ||
106 | for id, gril := range grils { | 108 | for _, gril := range grils { |
107 | list.Grils[id].Gril = gril | 109 | grilMap[gril.ID].Gril = gril |
108 | } | 110 | } |
109 | 111 | ||
110 | sort.Sort(ListGrils(list.Grils)) | 112 | sort.Sort(ListGrils(list.Grils)) |
diff --git a/views/includes/card.html b/views/includes/card.html index a96cb49..41ad2ce 100644 --- a/views/includes/card.html +++ b/views/includes/card.html | |||
@@ -1,6 +1,6 @@ | |||
1 | {{ define "card" }} | 1 | {{ define "card" }} |
2 | {{ $card := . }} | 2 | {{ $card := . }} |
3 | <div class="col s12 m6 l4"> | 3 | <div class="flex-card"> |
4 | <div class="card white"> | 4 | <div class="card white"> |
5 | <div class="card-content black-text"> | 5 | <div class="card-content black-text"> |
6 | {{ if $card.Image }} | 6 | {{ if $card.Image }} |
@@ -8,10 +8,10 @@ | |||
8 | <img class="circle responsive-img card-image" src="{{ $card.Image }}" /> | 8 | <img class="circle responsive-img card-image" src="{{ $card.Image }}" /> |
9 | </div> | 9 | </div> |
10 | {{ end }} | 10 | {{ end }} |
11 | <span class="card-title">{{ $card.Title | html }}</span> | 11 | <span class="card-title valign-wrapper">{{ $card.Title | html }}{{ if $card.SubTitle }}{{ $card.SubTitle | html }}{{ end }}</span> |
12 | <p>{{ $card.Description | html }}</p> | 12 | <p>{{ $card.Description | html }}</p> |
13 | </div> | 13 | </div> |
14 | <div class="card-action"> | 14 | <div class="card-action pull-down"> |
15 | {{ range $action := $card.Actions }} | 15 | {{ range $action := $card.Actions }} |
16 | {{ if $action.Disabled }} | 16 | {{ if $action.Disabled }} |
17 | <span>{{ $action.Name | html }}</span> | 17 | <span>{{ $action.Name | html }}</span> |
diff --git a/views/pages/dashboard.html b/views/pages/dashboard.html index 589b0fd..2eacaba 100644 --- a/views/pages/dashboard.html +++ b/views/pages/dashboard.html | |||
@@ -11,7 +11,7 @@ | |||
11 | <div class="row"> | 11 | <div class="row"> |
12 | {{ range $category := .categories }} | 12 | {{ range $category := .categories }} |
13 | <h2>{{ $category.Title }}</h2> | 13 | <h2>{{ $category.Title }}</h2> |
14 | <div class="row"> | 14 | <div class="flex"> |
15 | {{ range $category.Cards }} | 15 | {{ range $category.Cards }} |
16 | {{ template "card" . }} | 16 | {{ template "card" . }} |
17 | {{ end }} | 17 | {{ end }} |