Create shortcode to draw table of offerings
This commit is contained in:
parent
69368dd8e8
commit
ca6b1c16db
7
data/days.yml
Normal file
7
data/days.yml
Normal file
@ -0,0 +1,7 @@
|
||||
Mon: Montag
|
||||
Tue: Dienstag
|
||||
Wed: Mittwoch
|
||||
Thu: Donnerstag
|
||||
Fri: Freitag
|
||||
Sat: Samstag
|
||||
Sun: Sonntag
|
52
themes/tsc_vfl/layouts/shortcodes/tsc/calendar/table.html
Normal file
52
themes/tsc_vfl/layouts/shortcodes/tsc/calendar/table.html
Normal file
@ -0,0 +1,52 @@
|
||||
{{ $calendars := .Site.Data.schedule.calendars -}}
|
||||
{{- $list := slice -}}
|
||||
{{- range $room, $roomData := $calendars -}}
|
||||
{{- if ($roomData.ignore | default false) -}}{{ continue }}{{- end -}}
|
||||
{{- $roomName := $roomData.name | default $room -}}
|
||||
{{/* warnf "%s " $room */}}
|
||||
{{- range $roomData.schedule -}}
|
||||
{{- $addData := dict "room" $roomName "weight" 0 -}}
|
||||
{{- $addData = merge $addData . -}}
|
||||
{{/* warnf "%#v" $addData */}}
|
||||
{{- $list = $list | append $addData -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $cat := .Get "category" -}}
|
||||
{{- $showAge := .Get "showAge" | default false -}}
|
||||
{{- $list = sort $list "start" -}}
|
||||
{{- $list = sort $list "title" -}}
|
||||
{{- $list = sort $list "weight" -}}
|
||||
{{/* warnf "%#v" $list */}}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Gruppe</th>
|
||||
{{ if $showAge }}<th>Jahrgang</th>{{ end }}
|
||||
<th>Tag</th>
|
||||
<th>Zeit</th>
|
||||
<th>Ort</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range $list -}}
|
||||
{{- if ne .class $cat }}{{ continue }}{{ end -}}
|
||||
{{/* warnf "%#v" . */}}
|
||||
<tr>
|
||||
<td>
|
||||
{{ .title }}{{ with .subtitle }} - {{ . }}{{ end }}
|
||||
</td>
|
||||
{{ if $showAge }}<td>{{ .age }}</td>{{ end }}
|
||||
<td>{{ index site.Data.days .day }}</td>
|
||||
<td>
|
||||
{{- $startTimeStr := printf "2025-01-02T%s:00" .start -}}
|
||||
{{- $startTime := time.AsTime $startTimeStr -}}
|
||||
{{- $duration := time.Duration "minute" .duration -}}
|
||||
{{- $endTime := $startTime.Add $duration}}
|
||||
{{/* warnf "Start %s, duration %s, %s" $startTime $duration $endTime */}}
|
||||
{{- $startTime.Format "15:04"}} - {{ $endTime.Format "15:04" }}
|
||||
</td>
|
||||
<td>{{ .room }}</td>
|
||||
</tr>
|
||||
{{- end}}
|
||||
</tbody>
|
||||
</table>
|
Loading…
x
Reference in New Issue
Block a user