Cataloguer/layouts/partials/films/table-body.html
2023-02-17 19:13:50 -05:00

34 lines
1 KiB
HTML

{{ if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
{{ .Scratch.Set "filterCol" "Date Watched" }}
{{ .Scratch.Set "filterDir" "desc" }}
{{ else }}
{{ .Scratch.Set "filterCol" "Title" }}
{{ .Scratch.Set "filterDir" "asc" }}
{{ end }}
{{ range ( sort ( sort ( index $.Site.Data.films ( .Scratch.Get "listMode" ) ) "Title" "asc" ) ( .Scratch.Get "filterCol" ) ( .Scratch.Get "filterDir" ) ) }}
<tr>
<td>{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}</td>
<td>
{{- with ( where ( where $.Site.Pages "Section" "films" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="film">{{ .Title }}</cite>
{{- with ( where ( where $.Site.Pages "Section" "films" ) "Title" .Title ) -}}
</a>
{{- end -}}
</td>
<td>{{ index . "Release Year" }}</td>
<td>
{{- if ( index . "Date Watched" ) -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Watched" ) -}}
{{- if .Rewatch }} &#x21BB;{{ end -}}
{{- else -}}
n/a
{{- end -}}
</td>
</tr>
{{ end }}