From 6e7f370160af4e19e3cebc0304d4644078289b1c Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Sat, 17 Mar 2018 22:07:51 +0100
Subject: [PATCH] Improved templating

---
 templates/_footer.html     |  2 +-
 templates/_header.html     |  2 +-
 templates/_navigation.html | 23 +++++++++++++----------
 templates/me_images.html   | 14 +++++++-------
 templates/upload.html      | 20 ++++++++++----------
 5 files changed, 32 insertions(+), 29 deletions(-)

diff --git a/templates/_footer.html b/templates/_footer.html
index c4a5da5..fc1b9a5 100644
--- a/templates/_footer.html
+++ b/templates/_footer.html
@@ -1,2 +1,2 @@
-{{ define "footer"}}
+{{define "footer"}}
 {{end}}
\ No newline at end of file
diff --git a/templates/_header.html b/templates/_header.html
index affb686..b80dfbd 100644
--- a/templates/_header.html
+++ b/templates/_header.html
@@ -1,7 +1,7 @@
 {{define "header"}}
 <!DOCTYPE html>
 <meta charset="utf-8">
-<title>{{ template "title" .}}</title>
+<title>{{template "title" .}}</title>
 <link href="/assets/css/style.css" rel="stylesheet">
 <link href="/assets/css/fonts.css" rel="stylesheet">
 {{end}}
\ No newline at end of file
diff --git a/templates/_navigation.html b/templates/_navigation.html
index 56cebab..98537cb 100644
--- a/templates/_navigation.html
+++ b/templates/_navigation.html
@@ -1,10 +1,13 @@
-{{ define "navigation" }}
-{{ if .Id }}
-<p>Welcome, {{ .Name }}</p>
-<p>
-    <a href="/me/images">My Images</a> |
-    <a href="/me/albums">My Albums</a> |
-    <a href="/upload">Upload</a>
-</p>
-{{ end }}
-{{ end}}
\ No newline at end of file
+{{define "navigation"}}
+<nav>
+    <ul>
+        <li class="title">ik8r</li>
+    {{if .Id}}
+        <li class="upload"><a href="/upload">Upload</a></li>
+        <li class="images"><a href="/me/images">My Images</a></li>
+        <li class="albums"><a href="/me/albums">My Albums</a></li>
+        <li class="me"><a href="/me/">{{.Name}}</a></li>
+    {{end}}
+    </ul>
+</nav>
+{{end}}
\ No newline at end of file
diff --git a/templates/me_images.html b/templates/me_images.html
index ac8a629..e758ee8 100644
--- a/templates/me_images.html
+++ b/templates/me_images.html
@@ -1,17 +1,17 @@
 {{define "title"}}My Images | ik8r{{end}}
 {{define "content"}}
 <div class="images">
-{{ range .Images }}
-    <a class="image" href="/i/{{ .Id }}">
+{{range .Images}}
+    <a class="image" href="/i/{{.Id}}">
         <div class="image-container">
-            <img src="/i/{{ .Id }}t" >
+            <img src="/i/{{.Id}}t" >
         </div>
         <div class="info">
-            <p>{{ .OriginalName }}</p>
-            <p><time>{{ .CreatedAt.Format "2006-01-02 15:04" }}</time></p>
-            <p>{{ .MimeType }}</p>
+            <p>{{.OriginalName}}</p>
+            <p><time>{{.CreatedAt.Format "2006-01-02 15:04"}}</time></p>
+            <p>{{.MimeType}}</p>
         </div>
     </a>
-{{ end }}
+{{end}}
 </div>
 {{end}}
\ No newline at end of file
diff --git a/templates/upload.html b/templates/upload.html
index 215c130..1ae1bb4 100644
--- a/templates/upload.html
+++ b/templates/upload.html
@@ -1,19 +1,19 @@
 {{define "title"}}Upload | ik8r{{end}}
 {{define "content"}}
-{{ range .Results }}
-{{ if .Success }}
+{{range .Results}}
+{{if .Success}}
 <div class="info success">
-    <h2>Upload of {{ .Id }} finished. <a href="/i/{{ .Id }}">View</a>.</h2>
+    <h2>Upload of {{.Id}} finished. <a href="/i/{{.Id}}">View</a>.</h2>
 </div>
-{{ else }}
+{{else}}
 <div class="info error">
-    <h2>Upload of {{ .Id }} failed.</h2>
-{{ range .Errors }}
-    <pre>{{ . }}</pre>
-{{ end }}
+    <h2>Upload of {{.Id}} failed.</h2>
+{{range .Errors}}
+    <pre>{{.}}</pre>
+{{end}}
 </div>
-{{ end }}
-{{ end }}
+{{end}}
+{{end}}
 
 <form action="/upload/" method="POST" enctype="multipart/form-data">
     <input type="file" name="file" accept="image/jpeg,image/png,image/bmp,*.jpeg,*.jpg,*.png,*.bmp" multiple/>
-- 
GitLab