From 3a18696bdfafac78de7352a279b6450721b2462a Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Sat, 4 Jul 2015 22:20:01 -0700 Subject: [PATCH] add category form, template rework, comments --- templates/pages/categories.html | 72 ++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/templates/pages/categories.html b/templates/pages/categories.html index 003f9b7..315231b 100644 --- a/templates/pages/categories.html +++ b/templates/pages/categories.html @@ -1,22 +1,35 @@ {{define "body"}} -

Categories

-{{template "flashes" .}} - - -{{range $category := .categories}} - {{template "row-category" dict "category" $category "categories" $.categories}} -{{end}} - +

Categories

+ {{template "flashes" .}} + {{range $category := .categories}} + {{template "row-category" dict "category" $category "categories" $.categories}} + {{end}} + +
+
+
+ +
+
+ {{template "select-category" dict "categories" .categories "id" -1}} +
+
+ +
+
+
{{end}} + {{define "row-category"}}
- -
{{stringTimes .category.Depth "- "}} - - {{.category.Name}}
@@ -24,16 +37,11 @@
- + {{if $.category.Parent.Valid }} + {{template "select-category" dict "categories" .categories "id" $.category.Parent.Value}} + {{else}} + {{template "select-category" dict "categories" .categories "id" -1}} + {{end}}
@@ -44,9 +52,27 @@ {{end}} + +{{define "select-category"}} + +{{end}} + {{define "option-category"}} {{range $child := .category.Children}} {{template "option-category" dict "category" $child "id" $.id}} - {{end}} + {{end}} {{end}} \ No newline at end of file