Skip to content
Snippets Groups Projects
Commit 18bae5ac authored by gbe's avatar gbe
Browse files

Add header to index, show user name in header

parent cc63e9cb
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,8 @@ import (
"net/http"
"strconv"
"strings"
"git.c3pb.de/gbe/invinoveritas/auth"
)
var detailsTemplate = template.Must(template.ParseFS(templateFS, "templates/base.tpl", "templates/details.tpl"))
......@@ -183,7 +185,11 @@ func (h Handler) details(w http.ResponseWriter, r *http.Request) {
data := struct {
Wine Vino
}{v}
User string
}{
Wine: v,
User: auth.User(r),
}
err = detailsTemplate.ExecuteTemplate(w, "details.tpl", data)
if err != nil {
......
......@@ -7,6 +7,8 @@ import (
"log"
"net/http"
"strconv"
"git.c3pb.de/gbe/invinoveritas/auth"
)
var indexTemplate = template.Must(template.ParseFS(templateFS, "templates/base.tpl", "templates/index.tpl"))
......@@ -25,7 +27,11 @@ func (h Handler) index(w http.ResponseWriter, r *http.Request) {
data := struct {
Wines []Vino
}{wines}
User string
}{
Wines: wines,
User: auth.User(r),
}
err = indexTemplate.ExecuteTemplate(w, "index.tpl", data)
if err != nil {
......
......@@ -29,7 +29,7 @@ th.fill, td.fill {
div.content {
position: absolute;
top: 0;
top: 4.5em;
overflow: auto;
padding-top: 1em;
......@@ -58,7 +58,6 @@ footer {
}
div.details {
top: 4.5em;
bottom: 4.5em;
}
......
......@@ -7,6 +7,7 @@
<header class="pure-u-1">
<div class="maxwidth box">
<a class="pure-button" href="/">Back</a>
<span class="right">{{ .User }}</span>
</div>
</header>
......
......@@ -3,6 +3,12 @@
{{ define "title" }}Index{{ end }}
{{ define "content" }}
<header class="pure-u-1">
<div class="maxwidth box">
<span class="right">{{ .User }}</span>
</div>
</header>
<div class="content pure-u-1">
<div class="maxwidth box">
<table class="pure-table">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment