Make a group by date list

This commit is contained in:
Christian Wolf 2024-02-13 19:07:27 +01:00
parent a2cfe3459e
commit bc7b2d5e39
2 changed files with 18 additions and 25 deletions

View File

@ -926,26 +926,14 @@ table.time {
}
}
.turniermeldung-list {
.turniermeldung {
display: flex;
align-items: center;
.turniermeldungen-group-list {
.day {
.date {
font-weight: bold;
flex: auto 0 0;
margin: 10px 0 0;
}
.ort {
margin: 0 0 0 10px;
padding: 2px 0;
flex: auto 1 0;
a {
display: block;
width: 100%;
height: 100%;
padding: 3px 0;
box-sizing: border-box;
}
.participation {
margin: 0 0 0 2em;
}
}
}

View File

@ -3,15 +3,20 @@
<h1>{{ .Title }}</h1>
</a>
{{ $meldungen := where .Site.RegularPages "Section" "==" "turniermeldung" }}
<div class="turniermeldung-list">
{{ range (sort $meldungen ".Params.dateCompetition" "asc") }}
{{ $date := time.AsTime .Params.dateCompetition }}
{{ if ge $date (now.AddDate 0 0 -1) }}
<div class="turniermeldung">
<div class="date">{{ $date.Format "02.01.2006" }}</div>
<div class="ort"><a href="{{ .RelPermalink }}">{{ .Params.ort }} ({{ .Params.partner }} / {{ .Params.partnerin }})</a></div>
</div>
{{- $futureMeldungen := slice -}}
{{- range $meldungen -}}
{{- if ge (time.AsTime .Params.dateCompetition) (now.AddDate 0 0 -1) }}
{{- $futureMeldungen = $futureMeldungen | append . }}
{{- end }}
{{- end }}
<div class="turniermeldungen-group-list">
{{ range ( $futureMeldungen.GroupByParamDate "dateCompetition" "02.01.2006" "asc") }}
<div class="day">
<div class="date">{{ .Key }}</div>
{{ range .Pages }}
<div class="participation"><a href="{{ .RelPermalink }}">{{ .Params.ort }} ({{ .Params.partner }} / {{ .Params.partnerin }})</a></div>
{{ end }}
</div>
{{ end }}
</div>
{{ .Content }}