1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-03-10 13:38:20 +00:00
mycorrhiza/web/views/cat-edit.html

38 lines
2.0 KiB
HTML
Raw Permalink Normal View History

{{define "edit category x"}}Edit category {{beautifulName .}}{{end}}
{{define "title"}}{{template "edit category x" .CatName}}{{end}}
{{define "body"}}
<main class="main-width category">
<h1>{{block "edit category heading" .CatName}}Edit category <a href="/category/{{.}}">{{beautifulName .}}</a>{{end}}</h1>
{{if len .Hyphae | not}}
<p>{{block "empty cat" .}}This category is empty{{end}}</p>
{{end}}
{{if .GivenPermissionToModify}}
<h2>{{block "add to category title" .}}Add a hypha to the category{{end}}</h2>
<form method="POST" action="/add-to-category" class="add-to-category">
<input type="text" name="hypha" id="_hypha-name"
placeholder="{{block `hypha name` .}}Hypha name{{end}}">
<input type="hidden" name="cat" value="{{.CatName}}">
<input type="hidden" name="redirect-to" value="/category/{{.CatName}}">
<input type="submit" class="btn" value="{{block `add` .}}Add{{end}}">
</form>
{{if len .Hyphae}}
<h2>{{block "remove hyphae" .}}Remove hyphae from the category{{end}}</h2>
<form method="POST" action="/remove-from-category" class="multi-remove-from-category">
<ol>
{{range .Hyphae}}
<li>
<input type="checkbox" name="_{{.}}" id="_{{.}}">
<label for="_{{.}}"><a href="/hypha/{{.}}">{{beautifulName .}}</a></label>
</li>
{{end}}
</ol>
<input type="hidden" name="cat" value="{{.CatName}}">
<input type="hidden" name="redirect-to" value="/edit-category/{{.CatName}}">
<input type="submit" class="btn" value="{{block `remove` .}}Remove{{end}}">
</form>
{{end}}{{end}}
</main>
{{end}}