summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-09-01 13:58:22 +0200
committerKevin Chabowski <kevin@kch42.de>2013-09-01 13:58:22 +0200
commit0829fda06733674abdc340ec17c0fbfb4fd778ae (patch)
tree13bb6ba85f89b59d9bd1abbbb9757010213e4f79
parentef002c79acbade33272cf9b524ce561d990df2bf (diff)
downloadmailremind-0829fda06733674abdc340ec17c0fbfb4fd778ae.tar.gz
mailremind-0829fda06733674abdc340ec17c0fbfb4fd778ae.tar.bz2
mailremind-0829fda06733674abdc340ec17c0fbfb4fd778ae.zip
Began designing the interface.
* A simple stylesheet added * Templates modified
-rw-r--r--handler.go11
-rw-r--r--static/style.css71
-rw-r--r--tpls/jobs.tpl3
-rw-r--r--tpls/master.tpl31
4 files changed, 110 insertions, 6 deletions
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 @@
<td><a href="/jobedit/{{.ID}}">{{.Subject}}</a></td>
<td>{{.Excerpt}}</td>
<td>{{.Next}}</td>
+ </tr>
+ {{else}}<tr>
+ <td colspan="4" class="emptytab">No jobs found</td>
</tr>{{end}}
</tbody>
</table>
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 @@
<html>
<head>
- <title>{{template "title" .}} – mailremind</title>
+ <title>{{template "title" .Data}} – mailremind</title>
+ <link rel="stylesheet" type="text/css" href="/static/style.css" />
</head>
<body>
- <h1>{{template "title" .}}</h1>
-
- <div class="content">
- {{template "content" .}}
+ <div id="main">
+ <div id="nav">
+ <a href="/" class="apptitle">mailremind</a>
+ <ul>
+ {{if .Mail}}
+ <li><a href="/jobedit">new job</a></li>
+ <li><a href="/jobs">list jobs</a></li>
+ <li><a href="/logout">logout</a></li>
+ {{else}}
+ <li><a href="/register">register</a></li>
+ <li><a href="/login">login</a></li>
+ {{end}}
+ </ul>
+ </div>
+
+ <div id="content">
+ <h1>{{template "title" .Data}}</h1>
+ {{template "content" .Data}}
+ </div>
+
+ <div id="footer">
+ © 2013 Bla bla....<br />
+ Foo!
+ </div>
</div>
</body>
</html> \ No newline at end of file