transmet/templates/pages/post.html

30 lines
1.8 KiB
HTML

{{define "body"}}
<h2 class="form-add-heading">{{if eq .mode "add"}}Add Link{{else}}Edit News{{end}}</h2>
{{template "flashes" .}}
<form class="form-add" action="{{if eq "add" .mode}}/news/add{{else}}/news/{{.id}}/edit{{end}}" method="post" role="form" class="container col-form">
<input type="hidden" name="popup" value="{{.popup}}" />
<div class="row">
<div class="col-xs-2">Link:</div><div class="col-xs-10"><input type="text" class="form-control" name="link" placeholder="Link" value="{{.link}}"/></div>
<div class="col-xs-2">Title:</div><div class="col-xs-10"><input type="text" class="form-control" name="title" placeholder="Title" value="{{.title}}"/></div>
<div class="col-xs-2">Category:</div><div class="col-xs-10 add-category-col">
<select class="form-control add-category" name="category" placeholder="Category">
<option value="-1">-- Pick a Category --</option>
{{range $category := .categories}}
{{template "option-category" dict "category" $category "category_id" $.category_id}}
{{end}}
</select>
</div>
<div class="col-xs-2">Notes:</div><div class="col-xs-10"><textarea class="form-control" name="notes" placeholder="Notes" rows="5" cols="80">{{.notes}}</textarea></div>
<div class="col-xs-2"></div><div class="col-xs-10">{{ .csrfField }}<input class="add-submit btn btn-lg btn-primary btn-block" type="submit" value="{{if eq .mode "add"}}Add Link{{else}}Commit Edit{{end}}" /></div>
</div>
</form>
{{end}}
{{define "option-category"}}
<option value="{{.category.Id}}" {{if eq .category.Id .category_id}}selected="true"{{end}} >{{.category.ToString}}</option>
{{range $child := .category.Children}}
{{template "option-category" dict "category" $child "category_id" $.category_id}}
{{end}}
{{end}}