aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2016-04-12 17:28:52 +0200
committerDimitri Sokolyuk <demon@dim13.org>2016-04-12 17:28:52 +0200
commit98d80e03ee5b5c1d6941af440ca33a8793cd84dc (patch)
tree2e2b506255b816a90fc118cd3809ccbce20c32fb
parent2b9f6efe9b4e5112dcfbce67f91a08950d95fbf7 (diff)
Enable delete
-rw-r--r--tmpl/edit3
-rw-r--r--tmpl/index1
-rw-r--r--tmpl/root5
-rw-r--r--tmpl/view3
4 files changed, 8 insertions, 4 deletions
diff --git a/tmpl/edit b/tmpl/edit
index 2034f47..f4c5f2c 100644
--- a/tmpl/edit
+++ b/tmpl/edit
@@ -7,3 +7,6 @@
<input type="reset" value="Reset">
</form>
{{end}}
+{{define "action"}}
+<a href="/del/{{.Title}}" title="delete {{.Title}}"><i class="fa fa-trash"></i></a>
+{{end}}
diff --git a/tmpl/index b/tmpl/index
index e69a07d..7979e14 100644
--- a/tmpl/index
+++ b/tmpl/index
@@ -15,3 +15,4 @@
{{end}}
</table>
{{end}}
+{{define "action"}}{{end}}
diff --git a/tmpl/root b/tmpl/root
index 093ad19..c357ad1 100644
--- a/tmpl/root
+++ b/tmpl/root
@@ -10,10 +10,7 @@
<body>
<nav>
<span>{{template "title" .}}</span>
- {{with .Title -}}
- <a href="/edit/{{.}}" title="edit {{.}}"><i class="fa fa-pencil"></i></a>
- <!--a href="/del/{{.}}" title="delete {{.}}"><i class="fa fa-trash"></i></a-->
- {{- end}}
+ {{template "action" .}}
<a href="/" title="home"><i class="fa fa-home"></i></a>
<a href="/index" title="index"><i class="fa fa-list"></i></a>
</nav>
diff --git a/tmpl/view b/tmpl/view
index 68a4c4f..c816e34 100644
--- a/tmpl/view
+++ b/tmpl/view
@@ -1,2 +1,5 @@
{{define "title"}}{{.Title}}{{end}}
{{define "content"}}{{.HTML}}{{end}}
+{{define "action"}}
+<a href="/edit/{{.Title}}" title="edit {{.Title}}"><i class="fa fa-pencil"></i></a>
+{{end}}