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

79 lines
2.5 KiB
HTML

{{ if ( eq ( .Scratch.Get "listMode" ) "current" ) }}
{{ range ( sort $.Site.Data.games.current "Date Started" "desc" ) }}
<tr>
<td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td>
<td>
{{- if index . "Date Started" -}}
{{- time.Format "Jan 2, 2006" ( index . "Date Started" ) -}}
{{- else -}}
Unknown
{{- end -}}&ndash;Unknown
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "log" ) }}
<tr>
<td colspan=4><h3>Diary</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.games.log "Date Finished" "!=" "" ) "Date Finished" "desc" ) }}
<tr>
<td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</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 -}}
{{- if index . "Level of Completion" }} <span class="games__level-of-completion">({{ index . "Level of Completion" }})</span>{{- end -}}
</td>
</tr>
{{ end }}
<tr>
<td colspan=5><h3>Assorted</h3></td>
</tr>
{{ range ( sort ( where $.Site.Data.games.log "Date Finished" "" ) "Title" "asc" ) }}
<tr>
<td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</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 -}}
{{- if index . "Level of Completion" }} <span class="games__level-of-completion">({{ index . "Level of Completion" }})</span>{{- end -}}
</td>
</tr>
{{ end }}
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
{{ range ( sort $.Site.Data.games.wishlist "Title" "asc" ) }}
<tr>
<td>
{{- partial "cite" ( dict "c" . "schemaType" "VideoGame" ) -}}
</td>
<td>{{ index . "Date Released" }}</td>
<td>{{ .Platforms }}</td>
<td>n/a</td>
</tr>
{{ end }}
{{ end }}