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

53 lines
1.9 KiB
HTML
Raw Normal View History

2023-01-29 18:44:51 +00:00
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
2023-02-18 00:13:50 +00:00
{{ .Scratch.Set "filterCol" "Date Started" }}
2023-01-29 18:44:51 +00:00
{{ .Scratch.Set "filterDir" "asc" }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
2023-02-18 00:13:50 +00:00
{{ .Scratch.Set "filterCol" "Date Finished" }}
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>
2023-02-18 00:13:50 +00:00
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
2022-12-17 18:41:44 +00:00
<td>
2023-02-18 00:13:50 +00:00
<p>
2022-12-17 18:41:44 +00:00
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
2023-02-18 01:11:41 +00:00
{{ range . }}
<a href="{{ .RelPermalink }}">
2022-12-17 18:41:44 +00:00
{{ end }}
{{- end -}}
2023-02-18 00:13:50 +00:00
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
2022-12-17 18:41:44 +00:00
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
2023-02-18 00:13:50 +00:00
</p>
2022-12-17 18:41:44 +00:00
</td>
<td>
2023-02-18 00:13:50 +00:00
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
<p class="year">{{- index . "Year Published" -}}
{{- if ( index . "Original Publication Year" ) -}}
<span class="year--original">(orig.&nbsp;{{ index . "Orginal Publication Year" }})</span>
{{- end -}}
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- else -}}
Unknown
{{- end -}}&ndash;{{- if index . "Date Finished" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Finished" ) -}}
{{- else -}}
Unknown
{{- end -}}
2022-12-17 18:41:44 +00:00
</td>
</tr>
{{ end }}