aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2015-12-28 11:23:30 (UTC)
committerjan <jan@ruken.pw>2015-12-28 11:23:30 (UTC)
commit647c105dadfa58af6cfa80d3f359d43cfa5d5cf2 (patch)
tree895a68bcfc5f66da7bcfcdea5fe686f742e8cc21
parent0891a94767cafc13307482cd0c4f76db3bcc3b5e (diff)
anzeige im gril view, in wie vielen listen das gril vorkommt
-rw-r--r--assets/css/gril.css7
-rw-r--r--modules/grils/gril.go1
-rw-r--r--modules/grils/grils.go24
-rw-r--r--views/gril.html28
4 files changed, 50 insertions, 10 deletions
diff --git a/assets/css/gril.css b/assets/css/gril.css
index e22364a..5b5bd84 100644
--- a/assets/css/gril.css
+++ b/assets/css/gril.css
@@ -3,6 +3,11 @@ h1 > small {
3 font-size: 50%; 3 font-size: 50%;
4} 4}
5 5
6.card-title { 6.card-title.big {
7 font-size: 36px !important; 7 font-size: 36px !important;
8}
9
10.card-content.center-big {
11 padding-top: 9px;
12 padding-bottom: 9px;
8} \ No newline at end of file 13} \ No newline at end of file
diff --git a/modules/grils/gril.go b/modules/grils/gril.go
index 9fd3be5..edf25a9 100644
--- a/modules/grils/gril.go
+++ b/modules/grils/gril.go
@@ -23,4 +23,5 @@ type Gril struct {
23 Tags []string 23 Tags []string
24 ForeignIDs map[DataSource]int 24 ForeignIDs map[DataSource]int
25 UpdatedAt time.Time 25 UpdatedAt time.Time
26 Lists []int
26} 27}
diff --git a/modules/grils/grils.go b/modules/grils/grils.go
index e2eb543..a38f41f 100644
--- a/modules/grils/grils.go
+++ b/modules/grils/grils.go
@@ -74,6 +74,26 @@ func (m *GrilsModule) getGrils(whereClause string, params ...interface{}) ([]*Gr
74 return grils, nil 74 return grils, nil
75} 75}
76 76
77func (m *GrilsModule) GetListsOfGril(gril *Gril) error {
78 rows, err := m.g.DB.Query(`SELECT list_id FROM grilist.lists_grils WHERE gril_id = $1`, gril.ID)
79 if err != nil {
80 return err
81 }
82
83 defer rows.Close()
84 for rows.Next() {
85 var listID int
86 if err := rows.Scan(&listID); err != nil {
87 log.Println(err)
88 continue
89 }
90
91 gril.Lists = append(gril.Lists, listID)
92 }
93
94 return nil
95}
96
77func (m *GrilsModule) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory { 97func (m *GrilsModule) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory {
78 var categories []grilist.DashboardCategory 98 var categories []grilist.DashboardCategory
79 99
@@ -137,6 +157,10 @@ func (m *GrilsModule) viewGril(w http.ResponseWriter, r *http.Request, p httprou
137 return 157 return
138 } 158 }
139 159
160 if err := m.GetListsOfGril(gril); err != nil {
161 log.Println(err)
162 }
163
140 data := m.g.Renderer.DefaultData() 164 data := m.g.Renderer.DefaultData()
141 data["user"] = user 165 data["user"] = user
142 data["gril"] = gril 166 data["gril"] = gril
diff --git a/views/gril.html b/views/gril.html
index f3b7148..c7ecbdc 100644
--- a/views/gril.html
+++ b/views/gril.html
@@ -19,22 +19,32 @@
19 <br /> 19 <br />
20 <br /> 20 <br />
21 <div class="row"> 21 <div class="row">
22 {{ if $gril.Age.Valid }} 22 {{ if $gril.Birthday.Valid }}
23 <div class="col s6 m2 l2"> 23 <div class="col s6 m2 l2">
24 <div class="card"> 24 <div class="card">
25 <div class="card-content purple-text text-lighten-2 center-align"> 25 <div class="card-content purple-text text-lighten-2 center-align">
26 <span class="card-title">{{ $gril.Age.Value }}</span> 26 <span class="card-title big">{{ $gril.Birthday.Value}}</span>
27 <p>years old</p> 27 <p>geburtstag</p>
28 </div> 28 </div>
29 </div> 29 </div>
30 </div> 30 </div>
31 {{ end }} 31 {{ else if $gril.Age.Valid }}
32 {{ if $gril.Birthday.Valid }}
33 <div class="col s6 m2 l2"> 32 <div class="col s6 m2 l2">
34 <div class="card"> 33 <div class="card">
35 <div class="card-content purple-text text-lighten-2 center-align"> 34 <div class="card-content purple-text text-lighten-2 center-align">
36 <span class="card-title">{{ $gril.Birthday.Value}}</span> 35 <span class="card-title big">{{ $gril.Age.Value }}</span>
37 <p>birthday</p> 36 <p>jahre alt</p>
37 </div>
38 </div>
39 </div>
40 {{ end }}
41 {{ if $gril.Lists }}
42 <div class="col s6 m2 l2">
43 <div class="card">
44 <div class="card-content center-big purple-text text-lighten-2 center-align">
45 <p>in</p>
46 <span class="card-title big">{{ len $gril.Lists}}</span>
47 <p>liste{{ if ne (len $gril.Lists) 1 }}n{{ end }}</p>
38 </div> 48 </div>
39 </div> 49 </div>
40 </div> 50 </div>
@@ -42,8 +52,8 @@
42 <div class="col s12 m4 l4"> 52 <div class="col s12 m4 l4">
43 <div class="card"> 53 <div class="card">
44 <div class="card-content purple-text text-lighten-2 center-align"> 54 <div class="card-content purple-text text-lighten-2 center-align">
45 <span class="card-title">{{ $gril.UpdatedAt.Format "Jan 02, 2006" }}</span> 55 <span class="card-title big">{{ $gril.UpdatedAt.Format "Jan 02, 2006" }}</span>
46 <p>last updated</p> 56 <p>aktualisiert</p>
47 </div> 57 </div>
48 </div> 58 </div>
49 </div> 59 </div>