Schedule: optional title per tour and sold-out status

This commit is contained in:
Stefan Bethke 2026-10-16 19:04:05 +02:00
commit c4ee65b9af
5 changed files with 44 additions and 3 deletions

View file

@ -40,6 +40,10 @@ days:
- `tour` is the slug of the tour page in the event section. The card shows that page's title, without the event prefix, and links to it. - `tour` is the slug of the tour page in the event section. The card shows that page's title, without the event prefix, and links to it.
- `lang` is `de`, `en` or `deen`, or a list of these. It renders the same badge as the `lang` shortcode. - `lang` is `de`, `en` or `deen`, or a list of these. It renders the same badge as the `lang` shortcode.
- `time` is `HH:MM` with a leading zero (`09:30`). Tours are sorted by time, so their order in the file doesn't matter. - `time` is `HH:MM` with a leading zero (`09:30`). Tours are sorted by time, so their order in the file doesn't matter.
- `title` (optional) replaces the page's title on the card, with one entry per language: `title: { de: "Hafen am Abend", en: "Harbour by Night" }`.
- `status` (optional): `soldout` marks the tour as fully booked. Other values are ignored.
For the events managed with Hackertours-Admin, the data file is generated by its website sync; don't edit it by hand.
Wide screens get one column per day on an hour grid, with tours that start at the same time side by side. The first column shows the hour wherever the first day has no tour in it. On narrow screens a day picker shows one day at a time, starting with today's day during the event. Wide screens get one column per day on an hour grid, with tours that start at the same time side by side. The first column shows the hour wherever the first day has no tour in it. On narrow screens a day picker shows one day at a time, starting with today's day during the event.

View file

@ -126,6 +126,31 @@
} }
} }
.schedule__when {
display: flex;
flex-wrap: wrap;
align-items: baseline;
gap: 0 0.5rem;
}
.schedule__status {
font-family: var(--ff-alt);
font-size: var(--fs-xs);
font-weight: bold;
letter-spacing: 0.03em;
text-transform: uppercase;
color: var(--color-text-meta);
}
/* Fully booked: still listed and linked, but muted. */
.schedule__card--soldout {
border-inline-start-color: var(--schedule-line);
& .schedule__title {
color: var(--color-text-meta);
}
}
.schedule__time { .schedule__time {
font-family: var(--ff-alt); font-family: var(--ff-alt);
font-size: var(--fs-s); font-size: var(--fs-s);

View file

@ -1,2 +1,3 @@
schedule_day: "Tag {{ .Day }}" schedule_day: "Tag {{ .Day }}"
schedule_pick_day: "Tag auswählen" schedule_pick_day: "Tag auswählen"
schedule_soldout: "ausgebucht"

View file

@ -1,2 +1,3 @@
schedule_day: "Day {{ .Day }}" schedule_day: "Day {{ .Day }}"
schedule_pick_day: "Choose a day" schedule_pick_day: "Choose a day"
schedule_soldout: "fully booked"

View file

@ -76,16 +76,26 @@ so an hour without tours still gets a row.
{{- $seen = merge $seen (dict .time (add $nth 1)) }} {{- $seen = merge $seen (dict .time (add $nth 1)) }}
{{- $page := $.Page.GetPage .tour }} {{- $page := $.Page.GetPage .tour }}
{{- if not $page }}{{ warnf "schedule: %s: no page for tour %q on day %v" $event .tour $day.day }}{{ end }} {{- if not $page }}{{ warnf "schedule: %s: no page for tour %q on day %v" $event .tour $day.day }}{{ end }}
<li class="schedule__card" style="--schedule-row: {{ add (index $slotRow .time) $nth }}"> {{- $entry := . }}
{{- $soldOut := eq .status "soldout" }}
{{- /* A tour's own title, in the page's language, replaces its page's title. */}}
{{- $ownTitle := "" }}
{{- with .title }}{{ $ownTitle = index . site.Language.Name | default (index . "en") }}{{ end }}
<li class="schedule__card{{ if $soldOut }} schedule__card--soldout{{ end }}" style="--schedule-row: {{ add (index $slotRow .time) $nth }}">
<span class="schedule__when">
<time class="schedule__time" datetime="{{ $day.date }}T{{ .time }}">{{ .time }}</time> <time class="schedule__time" datetime="{{ $day.date }}T{{ .time }}">{{ .time }}</time>
{{- if $soldOut }}
<span class="schedule__status">{{ i18n "schedule_soldout" }}</span>
{{- end }}
</span>
{{- with .lang }} {{- with .lang }}
<span class="schedule__langs">{{ range (cond (reflect.IsSlice .) . (slice .)) }}{{ partial "lang-badge.html" (dict "code" . "class" "schedule__lang") }}{{ end }}</span> <span class="schedule__langs">{{ range (cond (reflect.IsSlice .) . (slice .)) }}{{ partial "lang-badge.html" (dict "code" . "class" "schedule__lang") }}{{ end }}</span>
{{- end }} {{- end }}
{{- with $page }} {{- with $page }}
{{- $title := .LinkTitle | replaceRE $prefix "" }} {{- $title := $ownTitle | default (.LinkTitle | replaceRE $prefix "") }}
<a class="schedule__title" href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a> <a class="schedule__title" href="{{ .RelPermalink }}" title="{{ $title }}">{{ $title }}</a>
{{- else }} {{- else }}
<span class="schedule__title">{{ .tour }}</span> <span class="schedule__title">{{ $ownTitle | default $entry.tour }}</span>
{{- end }} {{- end }}
</li> </li>
{{- end }} {{- end }}