add filter elements to page

This commit is contained in:
Rhiannon Morris 2020-08-03 23:10:52 +02:00
parent 3c77492294
commit ac73c80ea6
3 changed files with 99 additions and 0 deletions

View file

@ -43,6 +43,26 @@ make' title prefix nsfw infos = [b|@0
</h2>
</header>
<form id=filters>
<details>
<summary><h2>filters</h2></summary>
<div>
<h3>show only</h3>
<ul id=require class='buttonbar choice'>
$8.requireFilters
</ul>
<h3>exclude</h3>
<ul id=exclude class='buttonbar choice'>
$8.excludeFilters
</ul>
<a href=# id=clear>clear</a>
<a href=# id=reset>reset</a>
</div>
</details>
</form>
<main>
<ul class=grid>
$4.items
@ -70,6 +90,14 @@ make' title prefix nsfw infos = [b|@0
requireFilters = map (uncurry $ makeFilter "require") allTags
excludeFilters = map (uncurry $ makeFilter "exclude") allTags
makeFilter :: Text -> Text -> Int -> Builder
makeFilter prefix tag count = [b|@8
<li>
<input type=checkbox id="$id'" value="$*tag">
<label for="$id'">$*tag</label>
|]
where id' = [b|$*prefix$&_$tag'|]; tag' = escId tag
makeYearItems :: Bool -- ^ nsfw
-> Integer -- ^ year
-> [(FilePath, Info)]