36 lines
1.7 KiB
HTML
36 lines
1.7 KiB
HTML
{{define "category card"}}
|
|
{{if or .GivenPermissionToModify (len .Categories)}}
|
|
{{$hyphaName := .HyphaName}}
|
|
{{$givenPermission := .GivenPermissionToModify}}
|
|
<aside class="layout-card categories-card">
|
|
<h2 class="layout-card__title">{{block `categories` .}}Categories{{end}}</h2>
|
|
<ul class="categories-card__entries">
|
|
{{range .Categories}}
|
|
<li class="categories-card__entry">
|
|
<a class="categories-card__link" href="/category/{{.}}">{{beautifulName .}}</a>
|
|
<form method="POST" action="/remove-from-category" class="categories-card__remove-form">
|
|
<input type="hidden" name="cat" value="{{.}}">
|
|
<input type="hidden" name="hypha" value="{{$hyphaName}}">
|
|
<input type="hidden" name="redirect-to" value="/hypha/{{$hyphaName}}">
|
|
{{if $givenPermission}}
|
|
<input type="submit" value="x" class="btn categories-card__btn"
|
|
title="{{block `remove from category title` .}}Remove the hypha from this category{{end}}">
|
|
{{end}}
|
|
</form>
|
|
</li>
|
|
{{end}}
|
|
{{if .GivenPermissionToModify}}
|
|
<li class="categories-card__entry categories-card__add-to-cat">
|
|
<form method="POST" action="/add-to-category" class="categories-card__add-form">
|
|
<input type="text" name="cat" id="_cat-name"
|
|
placeholder="{{block `placeholder` .}}Category name...{{end}}">
|
|
<input type="hidden" name="hypha" value="{{$hyphaName}}">
|
|
<input type="hidden" name="redirect-to" value="/hypha/{{$hyphaName}}">
|
|
<input type="submit" class="btn categories-card__btn" value="+"
|
|
title="{{block `add to category title` .}}Add the hypha to this category{{end}}">
|
|
</form>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</aside>
|
|
{{end}}{{end}} |