Fix sorting
This commit is contained in:
parent
f5914ab8c5
commit
1d98bd9a56
1 changed files with 80 additions and 29 deletions
|
@ -1,33 +1,84 @@
|
|||
{{ 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 }}
|
||||
<tr>
|
||||
<td colspan=4><h3>Diary</h3></td>
|
||||
</tr>
|
||||
{{ range ( sort ( where $.Site.Data.films.log "Date Watched" "!=" "" ) "Date Watched" "desc" ) }}
|
||||
<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 }} ↻{{ end -}}
|
||||
{{- else -}}
|
||||
n/a
|
||||
{{- end -}}
|
||||
<cite class="film">{{ .Title }}</cite>
|
||||
{{- with ( where ( where $.Site.Pages "Section" "films" ) "Title" .Title ) -}}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
<tr>
|
||||
<td colspan=4><h3>Assorted</h3></td>
|
||||
</tr>
|
||||
{{ range ( sort ( where $.Site.Data.films.log "Date Watched" "" ) "Title" "asc" ) }}
|
||||
<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 }} ↻{{ end -}}
|
||||
{{- else -}}
|
||||
n/a
|
||||
{{- end -}}
|
||||
</td>
|
||||
<td>{{ index . "Release Year" }}</td>
|
||||
<td>
|
||||
{{- if ( index . "Date Watched" ) -}}
|
||||
{{- time.Format "Jan 2, 2006" ( index . "Date Watched" ) -}}
|
||||
{{- if .Rewatch }} ↻{{ end -}}
|
||||
{{- else -}}
|
||||
n/a
|
||||
{{- end -}}
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ else if ( eq ( .Scratch.Get "listMode" ) "wishlist" ) }}
|
||||
{{ range ( sort $.Site.Data.films.wishlist "Title" "asc" ) }}
|
||||
<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 }} ↻{{ end -}}
|
||||
{{- else -}}
|
||||
n/a
|
||||
{{- end -}}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue