From 647c105dadfa58af6cfa80d3f359d43cfa5d5cf2 Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 28 Dec 2015 12:23:30 +0100 Subject: anzeige im gril view, in wie vielen listen das gril vorkommt 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 { font-size: 50%; } -.card-title { +.card-title.big { font-size: 36px !important; +} + +.card-content.center-big { + padding-top: 9px; + padding-bottom: 9px; } \ 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 { Tags []string ForeignIDs map[DataSource]int UpdatedAt time.Time + Lists []int } 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 return grils, nil } +func (m *GrilsModule) GetListsOfGril(gril *Gril) error { + rows, err := m.g.DB.Query(`SELECT list_id FROM grilist.lists_grils WHERE gril_id = $1`, gril.ID) + if err != nil { + return err + } + + defer rows.Close() + for rows.Next() { + var listID int + if err := rows.Scan(&listID); err != nil { + log.Println(err) + continue + } + + gril.Lists = append(gril.Lists, listID) + } + + return nil +} + func (m *GrilsModule) ProvideDashboardData(user *charakterin.User) []grilist.DashboardCategory { var categories []grilist.DashboardCategory @@ -137,6 +157,10 @@ func (m *GrilsModule) viewGril(w http.ResponseWriter, r *http.Request, p httprou return } + if err := m.GetListsOfGril(gril); err != nil { + log.Println(err) + } + data := m.g.Renderer.DefaultData() data["user"] = user 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 @@

- {{ if $gril.Age.Valid }} + {{ if $gril.Birthday.Valid }}
- {{ $gril.Age.Value }} -

years old

+ {{ $gril.Birthday.Value}} +

geburtstag

- {{ end }} - {{ if $gril.Birthday.Valid }} + {{ else if $gril.Age.Valid }}
- {{ $gril.Birthday.Value}} -

birthday

+ {{ $gril.Age.Value }} +

jahre alt

+
+
+
+ {{ end }} + {{ if $gril.Lists }} +
+
+
+

in

+ {{ len $gril.Lists}} +

liste{{ if ne (len $gril.Lists) 1 }}n{{ end }}

@@ -42,8 +52,8 @@
- {{ $gril.UpdatedAt.Format "Jan 02, 2006" }} -

last updated

+ {{ $gril.UpdatedAt.Format "Jan 02, 2006" }} +

aktualisiert

-- cgit v0.10.1