Cataloguer/layouts/partials/books/table-body.html
2023-01-29 13:44:51 -05:00

36 lines
1.1 KiB
HTML

{{ 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" }}
{{ .Scratch.Set "filterDir" "desc" }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
{{ .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>
{{- if ( index . "Finished At" ) -}}
{{- index . "Finshed At" -}}
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
{{ end }}