transmet/templates/pages/categories.html

52 lines
1.7 KiB
HTML
Raw Normal View History

{{define "body"}}
<h2 class="form-categories-heading">Categories</h2>
{{template "flashes" .}}
2015-05-23 17:49:27 +00:00
{{range $category := .categories}}
2015-05-23 17:49:27 +00:00
{{template "row-category" dict "category" $category "categories" $.categories}}
{{end}}
{{end}}
{{define "row-category"}}
2015-05-23 17:49:27 +00:00
<div class="row">
2015-05-22 05:55:59 +00:00
2015-05-23 17:49:27 +00:00
<div class="col-xs-2">
{{stringTimes .category.Depth "- "}}
{{.category.Name}}
</div>
<div class="col-xs-1">
<a href="/categories/delete?id={{.category.Id}}">delete</a>
</div>
<div class="col-xs-3">
2015-06-21 18:42:05 +00:00
<form action="/categories/change-parent?cid={{.category.Id}}" method="POST">
<select class="form-control category-change-parent" name="parent" >
<option value="none" {{if not .category.Parent.Valid}} selected="true"{{end}}>-- None --</option>
{{range $category := .categories}}
{{if $.category.Parent.Valid }}
{{template "option-category" dict "category" $category "id" $.category.Parent.Value}}
{{else}}
{{template "option-category" dict "category" $category "id" -1}}
{{end}}
{{end}}
</select>
</form>
2015-05-23 17:49:27 +00:00
</div>
2015-05-22 05:55:59 +00:00
</div>
2015-05-23 17:49:27 +00:00
{{range $child := .category.Children}}
{{template "row-category" dict "category" $child "categories" $.categories}}
{{end}}
2015-05-22 05:55:59 +00:00
{{end}}
{{define "option-category"}}
2015-05-23 17:49:27 +00:00
<option value="{{.category.Id}}" {{if eq .id .category.Id}}selected="true"{{end}}>{{.category.ToString}}</option>
{{range $child := .category.Children}}
{{template "option-category" dict "category" $child "id" $.id}}
2015-05-22 05:55:59 +00:00
{{end}}
{{end}}