diff options
author | jan <jan@ruken.pw> | 2016-10-10 10:01:28 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2016-10-10 10:01:28 (UTC) |
commit | 0e17ffc1f088bb8ff2a4199bef5ab2a9247374bc (patch) | |
tree | 2f7694334552154f654f6fd0b11d14d43fb73c4a | |
parent | 2ec8084d1fd1e6cc1792acc99e7ef817f423ef8e (diff) |
isOwner ins template reinschreiben, Einstellungs-Button ins List view hinzufuegen
-rw-r--r-- | modules/lists/lists.go | 5 | ||||
-rw-r--r-- | views/pages/list.html | 45 |
2 files changed, 31 insertions, 19 deletions
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 | |||
276 | data := m.g.Renderer.DefaultData() | 276 | data := m.g.Renderer.DefaultData() |
277 | data["user"] = user | 277 | data["user"] = user |
278 | data["list"] = list | 278 | data["list"] = list |
279 | if user != nil && user.ID == list.Owner.ID { | ||
280 | data["isOwner"] = true | ||
281 | } else { | ||
282 | data["isOwner"] = false | ||
283 | } | ||
279 | 284 | ||
280 | m.g.Renderer.RenderPage("list", w, data) | 285 | m.g.Renderer.RenderPage("list", w, data) |
281 | } | 286 | } |
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 @@ | |||
13 | <body> | 13 | <body> |
14 | {{ template "navbar" . }} | 14 | {{ template "navbar" . }} |
15 | <div class="container"> | 15 | <div class="container"> |
16 | <h1>{{ $list.Name }} <small>von <a href="/user/{{ $list.Owner.ID }}/{{ $list.Owner.GetName}}">{{ $list.Owner.GetName }}</a></small></h1> | 16 | {{ if .isOwner }}<div class="row valign-wrapper"> |
17 | <div class="col s10">{{ end }} | ||
18 | <h1>{{ $list.Name }} <small>von <a href="/user/{{ $list.Owner.ID }}/{{ $list.Owner.GetName}}">{{ $list.Owner.GetName }}</a></small></h1> | ||
19 | {{ if .isOwner }}</div> | ||
20 | <div class="col s2 right-align"> | ||
21 | <a class="waves-effect waves-light purple lighten-4 btn" style="margin-top: 8px; width: auto"href="/list/{{ $list.ID }}/settings"> | ||
22 | <i class="material-icons">settings</i> | ||
23 | </a> | ||
24 | </div> | ||
25 | </div>{{ end }} | ||
17 | <blockquote>{{ $list.Description }}</blockquote><br /> | 26 | <blockquote>{{ $list.Description }}</blockquote><br /> |
18 | <div class="row"> | 27 | <div class="row"> |
19 | <div class="col s12 {{ if ($user) and eq $user.ID $list.Owner.ID }}l8{{ end }}"> | 28 | <div class="col s12 {{ if ($user) and eq $user.ID $list.Owner.ID }}l8{{ end }}"> |
@@ -27,25 +36,23 @@ | |||
27 | {{ end }} | 36 | {{ end }} |
28 | </ul> | 37 | </ul> |
29 | </div> | 38 | </div> |
30 | {{ if $user}} | 39 | {{ if .isOwner }} |
31 | {{ if eq $user.ID $list.Owner.ID }} | 40 | <div class="col s12 l4"> |
32 | <div class="col s12 l4"> | 41 | <div class="card-panel" style="margin-top: 14px"> |
33 | <div class="card-panel" style="margin-top: 14px"> | 42 | <span style="font-size: 130%">Gril hinzufügen</span><br /> |
34 | <span style="font-size: 130%">Gril hinzufügen</span><br /> | 43 | <form> |
35 | <form> | 44 | <div class="input-field"> |
36 | <div class="input-field"> | 45 | <input id="gril-add-search" class="gril-search" type="search" required> |
37 | <input id="gril-add-search" class="gril-search" type="search" required> | 46 | <label for="gril-add-search"><i class="material-icons">search</i></label> |
38 | <label for="gril-add-search"><i class="material-icons">search</i></label> | 47 | <i class="material-icons">close</i> |
39 | <i class="material-icons">close</i> | 48 | </div> |
40 | </div> | 49 | </form> |
41 | </form> | ||
42 | </div> | ||
43 | <div class="col s10 offset-s1"> | ||
44 | <ul class="collection search-results" id="search-results"> | ||
45 | </ul> | ||
46 | </div> | ||
47 | </div> | 50 | </div> |
48 | {{ end }} | 51 | <div class="col s10 offset-s1"> |
52 | <ul class="collection search-results" id="search-results"> | ||
53 | </ul> | ||
54 | </div> | ||
55 | </div> | ||
49 | {{ end }} | 56 | {{ end }} |
50 | </div> | 57 | </div> |
51 | </div> | 58 | </div> |