diff --git a/template.go b/template.go index 4d1ecaa..b5b6cd7 100644 --- a/template.go +++ b/template.go @@ -6,15 +6,16 @@ import ( ) type Status struct { - Search string - User string - Notif []Notification - Home bool - About bool - News bool - Upload bool - Stats bool - Help bool + Search string + User string + IsAdmin bool + Notif []Notification + Home bool + About bool + News bool + Upload bool + Stats bool + Help bool } func GetStatus(w http.ResponseWriter, r *http.Request) Status { @@ -22,6 +23,7 @@ func GetStatus(w http.ResponseWriter, r *http.Request) Status { sess := GetSession(r) sess.Save(w, r) s.User = sess.User + s.IsAdmin = sess.IsAdmin() s.Notif = sess.Notif return s } diff --git a/templates/book.html b/templates/book.html index efb4eed..14b534b 100644 --- a/templates/book.html +++ b/templates/book.html @@ -1,6 +1,6 @@ {{template "header.html" .S}} -{{$user := .S.User}} +{{$isAdmin := .S.IsAdmin}} {{with .Book}}