From 0829fda06733674abdc340ec17c0fbfb4fd778ae Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 1 Sep 2013 13:58:22 +0200 Subject: Began designing the interface. * A simple stylesheet added * Templates modified --- handler.go | 11 ++++++++- static/style.css | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tpls/jobs.tpl | 3 +++ tpls/master.tpl | 31 +++++++++++++++++++++---- 4 files changed, 110 insertions(+), 6 deletions(-) create mode 100644 static/style.css diff --git a/handler.go b/handler.go index 0dc2033..9d4bcdf 100644 --- a/handler.go +++ b/handler.go @@ -43,6 +43,11 @@ func userFromSess(sess *sessions.Session) model.User { return user } +type tpldata struct { + Mail string + Data interface{} +} + func mkHttpHandler(h Handler, tpl *template.Template) http.HandlerFunc { return func(rw http.ResponseWriter, req *http.Request) { sess, err := getSess(req) @@ -53,12 +58,16 @@ func mkHttpHandler(h Handler, tpl *template.Template) http.HandlerFunc { user := userFromSess(sess) outdata := h(user, sess, req) + mail := "" + if user != nil { + mail = user.Email() + } if err := sess.Save(req, rw); err != nil { log.Printf("Error while saving session: %s", err) } - if err := tpl.Execute(rw, outdata); err != nil { + if err := tpl.Execute(rw, &tpldata{mail, outdata}); err != nil { log.Printf("Error executing template %s: %s", tpl.Name(), err) } } diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..9ae1858 --- /dev/null +++ b/static/style.css @@ -0,0 +1,71 @@ +* { + font-family: sans-serif; +} + +body, html { + padding: 0px; + margin: 0px; +} + +#main { + width: 85%; + margin: 7.5mm auto 10mm; + padding: 0px; + border: 1px solid black; + border-top: none; +} + +#nav, #footer { + color: white; + background-color: black; + font-size: 10pt; +} + +#nav a, #footer a { + color: white; +} + +#content { + margin: 1mm 2mm 1mm; +} + +#footer { + text-align: center; +} + +#nav a { + text-decoration: none; +} + +.fullwidth { + width: 100%; +} + +.emptytab { + text-align: center; + font-style: italic; +} + +#nav { + position: relative; +} + +#nav ul { + position: absolute; + top: 0px; + right: 0px; + list-style: none; +} + +#nav ul li { + float: right; + padding: 0px 2mm 0px; +} + +#nav ul li:hover { + background-color: white; +} + +#nav ul li:hover a { + color: black; +} \ No newline at end of file diff --git a/tpls/jobs.tpl b/tpls/jobs.tpl index 9408e48..60d17f4 100644 --- a/tpls/jobs.tpl +++ b/tpls/jobs.tpl @@ -26,6 +26,9 @@ {{.Subject}} {{.Excerpt}} {{.Next}} + + {{else}} + No jobs found {{end}} diff --git a/tpls/master.tpl b/tpls/master.tpl index 4e2b90f..54098e9 100644 --- a/tpls/master.tpl +++ b/tpls/master.tpl @@ -1,12 +1,33 @@ - {{template "title" .}} – mailremind + {{template "title" .Data}} – mailremind + -

{{template "title" .}}

- -
- {{template "content" .}} +
+ + +
+

{{template "title" .Data}}

+ {{template "content" .Data}} +
+ +
\ No newline at end of file -- cgit v1.2.3-54-g00ecf