aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjan <jan@ruken.pw>2016-01-16 21:38:53 (UTC)
committerjan <jan@ruken.pw>2016-01-16 21:38:53 (UTC)
commit1f116227f8b3416113c5950183f2df91f9368782 (patch)
tree955d282f793eb1fa8714af2e671c376e9342d721
parent5812371696b716417f75eb0ba98ff14a03a5d0ad (diff)
fixieren der useransicht wenn man nicht eingeloggt ist. fixieren der listenansicht wenn man nicht eingeloggt ist.
-rw-r--r--modules/user/user.go2
-rw-r--r--views/list.html6
-rw-r--r--views/list_gril.html4
3 files changed, 8 insertions, 4 deletions
diff --git a/modules/user/user.go b/modules/user/user.go
index 2645919..da58382 100644
--- a/modules/user/user.go
+++ b/modules/user/user.go
@@ -52,7 +52,7 @@ func (m *Module) viewUser(w http.ResponseWriter, r *http.Request, p httprouter.P
52 } 52 }
53 53
54 user := currentUser 54 user := currentUser
55 if currentUser.ID != userID { 55 if user == nil || currentUser.ID != userID {
56 user, err = m.g.Charakterin.GetUserByID(userID) 56 user, err = m.g.Charakterin.GetUserByID(userID)
57 if err != nil { 57 if err != nil {
58 http.Redirect(w, r, "/", 302) 58 http.Redirect(w, r, "/", 302)
diff --git a/views/list.html b/views/list.html
index b9ef7c8..81e8825 100644
--- a/views/list.html
+++ b/views/list.html
@@ -20,7 +20,11 @@
20 <div class="col s12 {{ if ($user) and eq $user.ID $list.Owner.ID }}l8{{ end }}"> 20 <div class="col s12 {{ if ($user) and eq $user.ID $list.Owner.ID }}l8{{ end }}">
21 <ul id="gril-list" class="gril-list"> 21 <ul id="gril-list" class="gril-list">
22 {{ range $index, $lg := $list.Grils }} 22 {{ range $index, $lg := $list.Grils }}
23 {{ template "list_gril" makeRangePair $index (makeObject "Gril" $lg "IsListOwner" (and ($user) (eq $user.ID $list.Owner.ID) )) }} 23 {{ if $user }}
24 {{ template "list_gril" makeRangePair $index (makeObject "Gril" $lg "IsListOwner" (eq $user.ID $list.Owner.ID)) }}
25 {{ else }}
26 {{ template "list_gril" makeRangePair $index (makeObject "Gril" $lg "IsListOwner" false) }}
27 {{ end }}
24 {{ end }} 28 {{ end }}
25 </ul> 29 </ul>
26 </div> 30 </div>
diff --git a/views/list_gril.html b/views/list_gril.html
index 5cfd0df..37cf44c 100644
--- a/views/list_gril.html
+++ b/views/list_gril.html
@@ -5,12 +5,12 @@
5 <div class="col s3 m2"> 5 <div class="col s3 m2">
6 <div class="circle gril-img" style="background-image: url(/{{ .Value.Gril.Gril.ImagePath true }})"> </div> 6 <div class="circle gril-img" style="background-image: url(/{{ .Value.Gril.Gril.ImagePath true }})"> </div>
7 </div> 7 </div>
8 <div class="col s6 m6"> 8 <div class="col {{ if .Value.IsListOwner }}s6 m3{{ else }}s9 m10{{ end }}">
9 <span><a href="/gril/{{ .Value.Gril.Gril.Slug }}">{{ .Value.Gril.Gril.RomajiName }}</a><br /> 9 <span><a href="/gril/{{ .Value.Gril.Gril.Slug }}">{{ .Value.Gril.Gril.RomajiName }}</a><br />
10 <span class="jap-name">{{ .Value.Gril.Gril.KanjiName }}</span> 10 <span class="jap-name">{{ .Value.Gril.Gril.KanjiName }}</span>
11 </span> 11 </span>
12 </div> 12 </div>
13 {{ if (.Value.IsListOwner) }} 13 {{ if .Value.IsListOwner }}
14 <div class="col s3 m5"> 14 <div class="col s3 m5">
15 <div class="hide-on-med-and-up"> 15 <div class="hide-on-med-and-up">
16 <div class="row list-controls valign-wrapper"> 16 <div class="row list-controls valign-wrapper">