mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 21:40:26 +00:00
7865f77060
* /category lists categories * /category/<cat> shows the category
71 lines
2.3 KiB
HTML
71 lines
2.3 KiB
HTML
{{define "category card"}}
|
|
{{$hyphaName := .HyphaName}}
|
|
<aside class="layout-card categories-card">
|
|
<h2 class="layout-card__title">Categories</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}}">
|
|
<input type="submit" value="X">
|
|
</form>
|
|
</li>
|
|
{{end}}
|
|
<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="Category name">
|
|
<input type="hidden" name="hypha" value="{{$hyphaName}}">
|
|
<input type="hidden" name="redirect-to" value="/hypha/{{$hyphaName}}">
|
|
<input type="submit" value="Add to category">
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</aside>
|
|
{{end}}
|
|
|
|
{{define "category page"}}
|
|
{{$catName := .CatName}}
|
|
<main class="main-width category">
|
|
<h1>Category <i>{{$catName}}</i></h1>
|
|
{{if len .Hyphae}}
|
|
<p>This page lists all hyphae in the category.</p>
|
|
{{else}}
|
|
<p>This category has no hyphae.</p>
|
|
{{end}}
|
|
<ul class="category__entries">
|
|
{{range .Hyphae}}
|
|
<li class="category__entry">
|
|
<a class="wikilink" href="/hypha/{{.}}">{{beautifulName .}}</a>
|
|
</li>
|
|
{{end}}
|
|
<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="Hypha name">
|
|
<input type="hidden" name="cat" value="{{$catName}}">
|
|
<input type="hidden" name="redirect-to" value="/category/{{$catName}}">
|
|
<input type="submit" value="Add hypha to category">
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</main>
|
|
{{end}}
|
|
|
|
{{define "category list"}}
|
|
<main class="main-width category-list">
|
|
<h1>Category list</h1>
|
|
{{if len .Categories}}
|
|
<ul class="category-list__entries">
|
|
{{range .Categories}}
|
|
<li class="category-list__entry">
|
|
<a class="wikilink" href="/category/{{.}}">{{beautifulName .}}</a>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p>This wiki has no categories.</p>
|
|
{{end}}
|
|
</main>
|
|
{{end}} |