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

137 lines
4.8 KiB
HTML
Raw Normal View History

2023-01-29 18:44:51 +00:00
{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
2023-03-01 03:19:50 +00:00
{{ range ( sort $.Site.Data.books.current "Date Started" "desc" ) }}
<tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
2023-10-05 18:27:13 +00:00
{{- partial "cite" ( dict "c" . "schemaType" "Book" ) -}}
2023-03-01 03:19:50 +00:00
</td>
<td>
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
2023-10-05 18:27:13 +00:00
{{- partial "books/publication-year.html" . -}}
2023-03-01 03:19:50 +00:00
</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- end -}}&ndash;
</td>
2023-10-05 18:27:13 +00:00
</tr>
2023-03-01 03:19:50 +00:00
{{ end }}
2023-01-29 18:44:51 +00:00
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
2023-03-01 03:19:50 +00:00
<tr>
<td colspan=5><h3>Diary</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }}
<tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
<p>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</p>
</td>
<td>
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
2023-10-05 18:27:13 +00:00
{{- partial "books/publication-year.html" . -}}
2023-03-01 03:19:50 +00:00
</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 -}}
</td>
2023-10-05 18:27:13 +00:00
</tr>
2023-03-01 03:19:50 +00:00
{{ end }}
<tr>
<td colspan=5><h3>Assorted</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.books.log "Date Finished" "" ) "Title" "asc" ) }}
<tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
<p>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</p>
</td>
<td>
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
2023-10-05 18:27:13 +00:00
{{- partial "books/publication-year.html" . -}}
2023-03-01 03:19:50 +00:00
</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 -}}
</td>
2023-10-05 18:27:13 +00:00
</tr>
2023-03-01 03:19:50 +00:00
{{ end }}
2023-01-29 18:44:51 +00:00
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
2023-03-01 03:19:50 +00:00
{{ range ( sort $.Site.Data.books.wishlist "Title" "asc" ) }}
<tr>
<td>{{ if index . "Date Added" }}{{ time.Format "Jan 2, 2006" ( index . "Date Added" ) }}{{ else }}n/a{{end }}</td>
<td>
<p>
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
{{ range . }}
<a href="{{ .RelPermalink }}">
{{ end }}
{{- end -}}
<cite class="book">{{ .Title }}</cite>{{ if .Edition }} <span class="book--edition">({{ .Edition }})</span>{{ end }}
{{- with ( where ( where $.Site.Pages "Section" "books" ) "Title" .Title ) -}}
</a>
{{- end -}}
</p>
</td>
<td>
<p class="author">{{ .Author }}</p>
{{- if ( index . "Additional Authors" ) -}}
<p class="author--additional">Additional: {{ index . "Additional Authors" }}</p>
{{- end -}}
</td>
<td>
2023-10-05 18:27:13 +00:00
{{- partial "books/publication-year.html" . -}}
2023-03-01 03:19:50 +00:00
</td>
<td>n/a</td>
2023-10-05 18:27:13 +00:00
</tr>
2023-03-01 03:19:50 +00:00
{{ end }}
2022-12-17 18:41:44 +00:00
{{ end }}