Few seats left: mark tours as a whole, highlight in amber
Some checks failed
/ build (push) Has been cancelled
/ accessibility (push) Has been cancelled

The schedule badges tours listed in the data file's fewseats list below
their title; tour lists and the tour-map list badge pages with
params.fewseats. The date note is now an amber highlight. Shared i18n key
fewseats and partial fewseats-badge.html.
This commit is contained in:
Stefan Bethke 2026-11-16 10:06:09 +01:00
commit 6a140235fa
10 changed files with 80 additions and 8 deletions

View file

@ -1,6 +1,7 @@
@import './_schedule.css'; @import './_schedule.css';
@import './_schedule-40c3.css'; @import './_schedule-40c3.css';
@import './_tour-map.css'; @import './_tour-map.css';
@import './_fewseats.css';
@import './_gallery.css'; @import './_gallery.css';
@import './_events.css'; @import './_events.css';
@ -513,3 +514,15 @@ span.content-image {
width: 1em; width: 1em;
height: 1em; height: 1em;
} }
/* "Only a few seats left" (themes/hackertours/assets/css/_fewseats.css): the 40C3 amber and ink. */
:root {
--fewseats: var(--c40-amber);
--fewseats-text: var(--c40-ink);
}
/* Square, like the language badges. */
.schedule__status--fewseats,
.fewseats-badge {
border-radius: 0;
}

View file

@ -1,5 +1,6 @@
@import './_schedule.css'; @import './_schedule.css';
@import './_tour-map.css'; @import './_tour-map.css';
@import './_fewseats.css';
@import './_gallery.css'; @import './_gallery.css';
@import './_events.css'; @import './_events.css';

View file

@ -0,0 +1,31 @@
/* "Only a few seats left": amber highlight with dark text, which keeps its contrast on the
light and the dark page background. The date note in the schedule is filled
(_schedule.css); the badge for a tour as a whole is tinted, with an amber outline. */
:root {
--fewseats: #ffbc40;
--fewseats-text: #001300;
}
.fewseats-badge {
display: inline-block;
max-width: 100%;
padding: 0 0.4rem;
border: 1px solid var(--fewseats);
border-radius: 999px;
background: color-mix(in oklch, var(--fewseats) 22%, transparent);
color: var(--color-text);
font-family: var(--ff-alt);
font-size: var(--fs-xs);
font-weight: normal;
letter-spacing: normal;
line-height: 1.5;
text-decoration: none;
text-transform: none;
text-wrap: balance;
vertical-align: middle;
}
/* Next to a tour title in the lists: it moves below a long title as a whole. */
.fewseats-badge--title {
white-space: nowrap;
}

View file

@ -196,17 +196,29 @@
color: var(--color-text-meta); color: var(--color-text-meta);
} }
/* Only a few seats left: a quieter note than "fully booked", in the case the tour pages /* Only a few seats left on this date: an amber highlight (_fewseats.css), in the case the
use. If it doesn't fit next to the time it moves below it as a whole, and only breaks tour pages use. If it doesn't fit next to the time it moves below it as a whole, and only
(in balanced lines) when the card is narrower than the note. */ breaks (in balanced lines) when the card is narrower than the note. */
.schedule__status--fewseats { .schedule__status--fewseats {
min-width: 0; min-width: 0;
padding: 0 0.4rem;
border-radius: var(--radius-s);
background: var(--fewseats);
color: var(--fewseats-text);
font-weight: normal; font-weight: normal;
letter-spacing: normal; letter-spacing: normal;
text-transform: none; text-transform: none;
text-wrap: balance; text-wrap: balance;
} }
/* The tour as a whole has only a few seats left: a badge below the title. It stays under
the card-wide link, so clicking it opens the tour. */
.schedule__fewseats {
grid-column: 1 / -1;
justify-self: start;
max-width: 100%;
}
/* Fully booked: still listed and linked, but muted. */ /* Fully booked: still listed and linked, but muted. */
.schedule__card--soldout { .schedule__card--soldout {
border-inline-start-color: var(--schedule-line); border-inline-start-color: var(--schedule-line);

View file

@ -2,6 +2,7 @@ book_now: "Jetzt buchen"
calendar_meeting_point: "Hackertours-Desk" calendar_meeting_point: "Hackertours-Desk"
calendar_ics: "iCal Download" calendar_ics: "iCal Download"
calendar_google: "Google Calendar" calendar_google: "Google Calendar"
fewseats: "Nur wenige Plätze über"
gallery_enlarge: "Großansicht" gallery_enlarge: "Großansicht"
gallery_dialog: "Bildansicht" gallery_dialog: "Bildansicht"
gallery_close: "Schließen" gallery_close: "Schließen"
@ -11,7 +12,6 @@ logo_alt: "Hamburg Hackertours – Startseite"
map_39c3_title: "Karte der 39C3-Touren mit Wegen vom CCH (uMap)" map_39c3_title: "Karte der 39C3-Touren mit Wegen vom CCH (uMap)"
schedule_day: "Tag {{ .Day }}" schedule_day: "Tag {{ .Day }}"
schedule_pick_day: "Tag auswählen" schedule_pick_day: "Tag auswählen"
schedule_fewseats: "Nur wenige Plätze über"
schedule_soldout: "ausgebucht" schedule_soldout: "ausgebucht"
skip_to_content: "Zum Inhalt springen" skip_to_content: "Zum Inhalt springen"
tour_map_label: "Karte der Tourorte" tour_map_label: "Karte der Tourorte"

View file

@ -2,6 +2,7 @@ book_now: "Book now"
calendar_ics: "iCal download" calendar_ics: "iCal download"
calendar_google: "Google calendar" calendar_google: "Google calendar"
calendar_meeting_point: "Hackertours Desk" calendar_meeting_point: "Hackertours Desk"
fewseats: "only a few seats left"
gallery_enlarge: "enlarge" gallery_enlarge: "enlarge"
gallery_dialog: "Image viewer" gallery_dialog: "Image viewer"
gallery_close: "Close" gallery_close: "Close"
@ -11,7 +12,6 @@ logo_alt: "Hamburg Hackertours – home page"
map_39c3_title: "Map of the 39C3 tours with routes from the CCH (uMap)" map_39c3_title: "Map of the 39C3 tours with routes from the CCH (uMap)"
schedule_day: "Day {{ .Day }}" schedule_day: "Day {{ .Day }}"
schedule_pick_day: "Choose a day" schedule_pick_day: "Choose a day"
schedule_fewseats: "only a few seats left"
schedule_soldout: "fully booked" schedule_soldout: "fully booked"
skip_to_content: "Skip to content" skip_to_content: "Skip to content"
tour_map_label: "Map of the tour locations" tour_map_label: "Map of the tour locations"

View file

@ -0,0 +1,3 @@
{{- /* "Only a few seats left" badge for a tour as a whole (front matter params.fewseats, or the
fewseats list in data/schedule/<event>.yaml). Param: class (optional, added to fewseats-badge). */ -}}
<span class="fewseats-badge{{ with .class }} {{ . }}{{ end }}">{{ i18n "fewseats" }}</span>

View file

@ -9,9 +9,14 @@ or {{< schedule 39c3 >}}.
{{- /* A missing or empty data file, or one without tours, renders nothing but a warning. */ -}} {{- /* A missing or empty data file, or one without tours, renders nothing but a warning. */ -}}
{{- $file := false -}} {{- $file := false -}}
{{- $days := slice -}} {{- $days := slice -}}
{{- /* Tours (by slug) with only a few seats left as a whole; dates have their own status. */ -}}
{{- $fewSeatsTours := slice -}}
{{- with hugo.Data.schedule -}} {{- with hugo.Data.schedule -}}
{{- if isset . $event }}{{ $file = true }}{{ end -}} {{- if isset . $event }}{{ $file = true }}{{ end -}}
{{- with index . $event }}{{ with .days }}{{ $days = . }}{{ end }}{{ end -}} {{- with index . $event }}
{{- with .days }}{{ $days = . }}{{ end -}}
{{- with .fewseats }}{{ if reflect.IsSlice . }}{{ $fewSeatsTours = . }}{{ end }}{{ end -}}
{{- end -}}
{{- end -}} {{- end -}}
{{- $tourCount := 0 -}} {{- $tourCount := 0 -}}
{{- range $days }}{{ with .tours }}{{ $tourCount = add $tourCount (len .) }}{{ end }}{{ end -}} {{- range $days }}{{ with .tours }}{{ $tourCount = add $tourCount (len .) }}{{ end }}{{ end -}}
@ -105,7 +110,7 @@ so an hour without tours still gets a row.
{{- if $soldOut }} {{- if $soldOut }}
<span class="schedule__status">{{ i18n "schedule_soldout" }}</span> <span class="schedule__status">{{ i18n "schedule_soldout" }}</span>
{{- else if $fewSeats }} {{- else if $fewSeats }}
<span class="schedule__status schedule__status--fewseats">{{ i18n "schedule_fewseats" }}</span> <span class="schedule__status schedule__status--fewseats">{{ i18n "fewseats" }}</span>
{{- end }} {{- end }}
</span> </span>
{{- with .lang }} {{- with .lang }}
@ -117,6 +122,9 @@ so an hour without tours still gets a row.
{{- else }} {{- else }}
<span class="schedule__title">{{ $ownTitle | default $entry.tour }}</span> <span class="schedule__title">{{ $ownTitle | default $entry.tour }}</span>
{{- end }} {{- end }}
{{- if in $fewSeatsTours $entry.tour }}
<span class="schedule__fewseats">{{ partial "fewseats-badge.html" dict }}</span>
{{- end }}
{{- with $photo }} {{- with $photo }}
<figure class="schedule__photo"> <figure class="schedule__photo">
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $photoAlt }}" loading="lazy" decoding="async"> <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="{{ $photoAlt }}" loading="lazy" decoding="async">

View file

@ -19,9 +19,11 @@ or {{< tour-map 39c3 >}}.
{{- with $tour.geo -}} {{- with $tour.geo -}}
{{- $title := $slug -}} {{- $title := $slug -}}
{{- $url := "" -}} {{- $url := "" -}}
{{- $fewSeats := false -}}
{{- with $.Page.GetPage $slug -}} {{- with $.Page.GetPage $slug -}}
{{- $title = .LinkTitle | replaceRE $prefix "" -}} {{- $title = .LinkTitle | replaceRE $prefix "" -}}
{{- $url = .RelPermalink -}} {{- $url = .RelPermalink -}}
{{- $fewSeats = eq .Params.fewseats true -}}
{{- else -}} {{- else -}}
{{- warnf "tour-map: %s: no page for tour %q" $event $slug -}} {{- warnf "tour-map: %s: no page for tour %q" $event $slug -}}
{{- end -}} {{- end -}}
@ -39,6 +41,7 @@ or {{< tour-map 39c3 >}}.
{{- $tours = $tours | append (dict {{- $tours = $tours | append (dict
"title" $title "title" $title
"url" $url "url" $url
"fewseats" $fewSeats
"lat" .lat "lat" .lat
"lon" .lon "lon" .lon
"color" ($tour.color | default "") "color" ($tour.color | default "")
@ -71,6 +74,7 @@ or {{< tour-map 39c3 >}}.
{{- range $tours }} {{- range $tours }}
<li> <li>
{{- if .url }}<a href="{{ .url }}">{{ .title }}</a>{{ else }}{{ .title }}{{ end }} {{- if .url }}<a href="{{ .url }}">{{ .title }}</a>{{ else }}{{ .title }}{{ end }}
{{- if .fewseats }} {{ partial "fewseats-badge.html" dict }}{{ end }}
(<a href="https://www.openstreetmap.org/?mlat={{ .lat }}&amp;mlon={{ .lon }}#map=17/{{ .lat }}/{{ .lon }}">{{ i18n "tour_map_osm" }}</a>) (<a href="https://www.openstreetmap.org/?mlat={{ .lat }}&amp;mlon={{ .lon }}#map=17/{{ .lat }}/{{ .lon }}">{{ i18n "tour_map_osm" }}</a>)
{{- with .directions }}{{ . }}{{ end }} {{- with .directions }}{{ . }}{{ end }}
</li> </li>

View file

@ -4,7 +4,7 @@
{{- if .Param "showPostDate" | default false }} {{- if .Param "showPostDate" | default false }}
{{- $postDate = .Params.date.Format .Site.Params.dateFormat }} {{- $postDate = .Params.date.Format .Site.Params.dateFormat }}
{{- end }} {{- end }}
<h2 class="title mt--s{{ if $.Param "submitted" | default false }} mb--xxs{{ end }}"><a href="{{ .RelPermalink }}">{{ .Title }}</a> <span class="title-post-date">{{ $postDate }}</span></h2> <h2 class="title mt--s{{ if $.Param "submitted" | default false }} mb--xxs{{ end }}"><a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ if eq .Params.fewseats true }} {{ partial "fewseats-badge.html" (dict "class" "fewseats-badge--title") }}{{ end }} <span class="title-post-date">{{ $postDate }}</span></h2>
{{ if $.Param "submitted" | default false }}{{ partial "submitted.html" . -}}{{ end }} {{ if $.Param "submitted" | default false }}{{ partial "submitted.html" . -}}{{ end }}
</header> </header>