Cataloguer/layouts/partials/books/table-body.html

37 lines
1.1 KiB
HTML
Raw Normal View History

2023-01-29 18:44:51 +00:00
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ .Scratch.Set "filterCol" "Started At" }}
{{ .Scratch.Set "filterDir" "asc" }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
{{ .Scratch.Set "filterCol" "Finished At" }}
2022-12-17 18:41:44 +00:00
{{ .Scratch.Set "filterDir" "desc" }}
2023-01-29 18:44:51 +00:00
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
2022-12-17 18:41:44 +00:00
{{ .Scratch.Set "filterCol" "Title" }}
{{ .Scratch.Set "filterDir" "asc" }}
{{ end }}
{{ range ( sort ( sort ( index $.Site.Data.books ( .Scratch.Get "listMode" ) ) "Title" "asc" ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }}
<tr>
<td>{{ index . "Date Added" }}</td>
<td>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="film">{{ .Title }}</cite>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</td>
<td>{{ .Author }}</td>
<td>{{ index . "Year Published" }}</td>
<td>
2023-01-29 18:44:51 +00:00
{{- if ( index . "Finished At" ) -}}
{{- index . "Finshed At" -}}
2022-12-17 18:41:44 +00:00
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
{{ end }}