From 0e17ffc1f088bb8ff2a4199bef5ab2a9247374bc Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 10 Oct 2016 12:01:28 +0200 Subject: isOwner ins template reinschreiben, Einstellungs-Button ins List view hinzufuegen diff --git a/modules/lists/lists.go b/modules/lists/lists.go index 007e927..a219bcc 100644 --- a/modules/lists/lists.go +++ b/modules/lists/lists.go @@ -276,6 +276,11 @@ func (m *Module) viewList(w http.ResponseWriter, r *http.Request, p httprouter.P data := m.g.Renderer.DefaultData() data["user"] = user data["list"] = list + if user != nil && user.ID == list.Owner.ID { + data["isOwner"] = true + } else { + data["isOwner"] = false + } m.g.Renderer.RenderPage("list", w, data) } diff --git a/views/pages/list.html b/views/pages/list.html index 7257f12..f3c652b 100644 --- a/views/pages/list.html +++ b/views/pages/list.html @@ -13,7 +13,16 @@ {{ template "navbar" . }}
-

{{ $list.Name }} von {{ $list.Owner.GetName }}

+ {{ if .isOwner }}
+
{{ end }} +

{{ $list.Name }} von {{ $list.Owner.GetName }}

+ {{ if .isOwner }}
+ +
{{ end }}
{{ $list.Description }}

@@ -27,25 +36,23 @@ {{ end }}
- {{ if $user}} - {{ if eq $user.ID $list.Owner.ID }} -
-
- Gril hinzufügen
-
-
- - - close -
-
-
-
-
    -
-
+ {{ if .isOwner }} +
+
+ Gril hinzufügen
+
+
+ + + close +
+
- {{ end }} +
+
    +
+
+
{{ end }}
-- cgit v0.10.1