-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathindex.html
39 lines (39 loc) · 1.74 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{{ template "head" . }}
<main>
{{ if len .Data.Threads | eq 0 }}
<p> There are currently no threads. </p>
{{ else if len .Data.Categories | lt 1 }}
<details>
<summary> filter threads (showing {{ len .Data.VisibleCategoriesMap }} of {{ len .Data.Categories
}} categories)</summary>
<form id="reset-categories" type="GET" action="/"></form>
<form id="filter-form" type="GET" action="/" style="display: grid; grid-template-columns: repeat(2, max-content); grid-column-gap: 0.5rem;">
{{ $categoryMap := index .Data.VisibleCategoriesMap }}
{{ range $index, $category := .Data.Categories}}
{{ $showCategory := index $categoryMap $category }}
<span>
<input type="hidden" form="reset-categories" value="{{ $category }}" name="show"/>
<input type="checkbox" id="filter-{{$category}}" {{ if $showCategory }} checked {{ end }} value="{{ $category }}" name="show"/>
<label style="display: inline-block;" for="filter-{{$category}}">{{ $category }}</label>
</span>
{{ end }}
</form>
<button form="reset-categories" type="submit">show all</button>
<button form="filter-form" type="submit">filter</button>
</details>
{{ end }}
{{ range $index, $thread := .Data.Threads }}
{{ if $thread.Show }}
<h2>
<a href="{{$thread.Slug}}">{{ $thread.Title }}</a>
{{ if $thread.Private }} <span title='{{ "Private" | translate }}'>⚿</span> {{ end }}
</h2>
{{ end }}
{{ end }}
</main>
{{ if .LoggedIn }}
<aside>
<p> <a href="/thread/new">{{ "ThreadStartNew" | translate }}</a></p>
</aside>
{{ end }}
{{ template "footer" . }}