mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-16 06:50:26 +00:00
82 lines
3.0 KiB
HTML
82 lines
3.0 KiB
HTML
{{define "category x"}}Category {{. | beautifulName}}{{end}}
|
|
|
|
{{define "category card"}}
|
|
{{$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}}
|
|
|
|
{{define "category page"}}
|
|
{{$catName := .CatName}}
|
|
<main class="main-width category">
|
|
<h1>{{block "cat" .}}Category{{end}} <i>{{beautifulName $catName}}</i></h1>
|
|
{{if len .Hyphae | not}}
|
|
<p>{{block "empty cat" .}}This category is empty{{end}}</p>
|
|
{{end}}
|
|
<ul class="category__entries">
|
|
{{range .Hyphae}}
|
|
<li class="category__entry">
|
|
<a class="category__link" href="/hypha/{{.}}">{{beautifulName .}}</a>
|
|
</li>
|
|
{{end}}
|
|
{{if .GivenPermissionToModify}}
|
|
<li class="category__entry category__add-to-cat">
|
|
<form method="POST" action="/add-to-category" class="category__add-form">
|
|
<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 hypha` .}}Add to the category{{end}}">
|
|
</form>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</main>
|
|
{{end}}
|
|
|
|
{{define "category list"}}
|
|
<main class="main-width category-list">
|
|
<h1>{{block `category list heading` .}}Category list{{end}}</h1>
|
|
{{if len .Categories}}
|
|
<ul class="category-list__entries">
|
|
{{range .Categories}}
|
|
<li class="category-list__entry">
|
|
<a class="category-list__link" href="/category/{{.}}">{{beautifulName .}}</a>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p>{{block `no categories` .}}This wiki has no categories.{{end}}</p>
|
|
{{end}}
|
|
</main>
|
|
{{end}} |