From 6a140235fa7aa6ce4c2bb38144d7a788d488e4af Mon Sep 17 00:00:00 2001 From: Stefan Bethke Date: Mon, 16 Nov 2026 10:06:09 +0100 Subject: [PATCH] Few seats left: mark tours as a whole, highlight in amber 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. --- .../hackertours-40c3/assets/css/_custom.css | 13 ++++++++ themes/hackertours/assets/css/_custom.css | 1 + themes/hackertours/assets/css/_fewseats.css | 31 +++++++++++++++++++ themes/hackertours/assets/css/_schedule.css | 18 +++++++++-- themes/hackertours/i18n/de.yaml | 2 +- themes/hackertours/i18n/en.yaml | 2 +- .../layouts/_partials/fewseats-badge.html | 3 ++ .../layouts/_shortcodes/schedule.html | 12 +++++-- .../layouts/_shortcodes/tour-map.html | 4 +++ themes/hackertours/layouts/summary.html | 2 +- 10 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 themes/hackertours/assets/css/_fewseats.css create mode 100644 themes/hackertours/layouts/_partials/fewseats-badge.html diff --git a/themes/hackertours-40c3/assets/css/_custom.css b/themes/hackertours-40c3/assets/css/_custom.css index c6b7bcf..2d754b7 100644 --- a/themes/hackertours-40c3/assets/css/_custom.css +++ b/themes/hackertours-40c3/assets/css/_custom.css @@ -1,6 +1,7 @@ @import './_schedule.css'; @import './_schedule-40c3.css'; @import './_tour-map.css'; +@import './_fewseats.css'; @import './_gallery.css'; @import './_events.css'; @@ -513,3 +514,15 @@ span.content-image { width: 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; +} diff --git a/themes/hackertours/assets/css/_custom.css b/themes/hackertours/assets/css/_custom.css index a84ebf6..fe78da1 100644 --- a/themes/hackertours/assets/css/_custom.css +++ b/themes/hackertours/assets/css/_custom.css @@ -1,5 +1,6 @@ @import './_schedule.css'; @import './_tour-map.css'; +@import './_fewseats.css'; @import './_gallery.css'; @import './_events.css'; diff --git a/themes/hackertours/assets/css/_fewseats.css b/themes/hackertours/assets/css/_fewseats.css new file mode 100644 index 0000000..5f9780d --- /dev/null +++ b/themes/hackertours/assets/css/_fewseats.css @@ -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; +} diff --git a/themes/hackertours/assets/css/_schedule.css b/themes/hackertours/assets/css/_schedule.css index fbc29c7..c36edb7 100644 --- a/themes/hackertours/assets/css/_schedule.css +++ b/themes/hackertours/assets/css/_schedule.css @@ -196,17 +196,29 @@ color: var(--color-text-meta); } -/* Only a few seats left: a quieter note than "fully booked", in the case the tour pages - use. If it doesn't fit next to the time it moves below it as a whole, and only breaks - (in balanced lines) when the card is narrower than the note. */ +/* Only a few seats left on this date: an amber highlight (_fewseats.css), in the case the + tour pages use. If it doesn't fit next to the time it moves below it as a whole, and only + breaks (in balanced lines) when the card is narrower than the note. */ .schedule__status--fewseats { min-width: 0; + padding: 0 0.4rem; + border-radius: var(--radius-s); + background: var(--fewseats); + color: var(--fewseats-text); font-weight: normal; letter-spacing: normal; text-transform: none; 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. */ .schedule__card--soldout { border-inline-start-color: var(--schedule-line); diff --git a/themes/hackertours/i18n/de.yaml b/themes/hackertours/i18n/de.yaml index f19e60f..cef42f0 100644 --- a/themes/hackertours/i18n/de.yaml +++ b/themes/hackertours/i18n/de.yaml @@ -2,6 +2,7 @@ book_now: "Jetzt buchen" calendar_meeting_point: "Hackertours-Desk" calendar_ics: "iCal Download" calendar_google: "Google Calendar" +fewseats: "Nur wenige Plätze über" gallery_enlarge: "Großansicht" gallery_dialog: "Bildansicht" 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)" schedule_day: "Tag {{ .Day }}" schedule_pick_day: "Tag auswählen" -schedule_fewseats: "Nur wenige Plätze über" schedule_soldout: "ausgebucht" skip_to_content: "Zum Inhalt springen" tour_map_label: "Karte der Tourorte" diff --git a/themes/hackertours/i18n/en.yaml b/themes/hackertours/i18n/en.yaml index a05e6b3..3cbff15 100644 --- a/themes/hackertours/i18n/en.yaml +++ b/themes/hackertours/i18n/en.yaml @@ -2,6 +2,7 @@ book_now: "Book now" calendar_ics: "iCal download" calendar_google: "Google calendar" calendar_meeting_point: "Hackertours Desk" +fewseats: "only a few seats left" gallery_enlarge: "enlarge" gallery_dialog: "Image viewer" 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)" schedule_day: "Day {{ .Day }}" schedule_pick_day: "Choose a day" -schedule_fewseats: "only a few seats left" schedule_soldout: "fully booked" skip_to_content: "Skip to content" tour_map_label: "Map of the tour locations" diff --git a/themes/hackertours/layouts/_partials/fewseats-badge.html b/themes/hackertours/layouts/_partials/fewseats-badge.html new file mode 100644 index 0000000..9b874b3 --- /dev/null +++ b/themes/hackertours/layouts/_partials/fewseats-badge.html @@ -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/.yaml). Param: class (optional, added to fewseats-badge). */ -}} +{{ i18n "fewseats" }} diff --git a/themes/hackertours/layouts/_shortcodes/schedule.html b/themes/hackertours/layouts/_shortcodes/schedule.html index e2247ab..48f9c9f 100644 --- a/themes/hackertours/layouts/_shortcodes/schedule.html +++ b/themes/hackertours/layouts/_shortcodes/schedule.html @@ -9,9 +9,14 @@ or {{< schedule 39c3 >}}. {{- /* A missing or empty data file, or one without tours, renders nothing but a warning. */ -}} {{- $file := false -}} {{- $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 -}} {{- 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 -}} {{- $tourCount := 0 -}} {{- 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 }} {{ i18n "schedule_soldout" }} {{- else if $fewSeats }} -{{ i18n "schedule_fewseats" }} +{{ i18n "fewseats" }} {{- end }} {{- with .lang }} @@ -117,6 +122,9 @@ so an hour without tours still gets a row. {{- else }} {{ $ownTitle | default $entry.tour }} {{- end }} +{{- if in $fewSeatsTours $entry.tour }} +{{ partial "fewseats-badge.html" dict }} +{{- end }} {{- with $photo }}
{{ $photoAlt }} diff --git a/themes/hackertours/layouts/_shortcodes/tour-map.html b/themes/hackertours/layouts/_shortcodes/tour-map.html index 1520d46..fea3a3f 100644 --- a/themes/hackertours/layouts/_shortcodes/tour-map.html +++ b/themes/hackertours/layouts/_shortcodes/tour-map.html @@ -19,9 +19,11 @@ or {{< tour-map 39c3 >}}. {{- with $tour.geo -}} {{- $title := $slug -}} {{- $url := "" -}} + {{- $fewSeats := false -}} {{- with $.Page.GetPage $slug -}} {{- $title = .LinkTitle | replaceRE $prefix "" -}} {{- $url = .RelPermalink -}} + {{- $fewSeats = eq .Params.fewseats true -}} {{- else -}} {{- warnf "tour-map: %s: no page for tour %q" $event $slug -}} {{- end -}} @@ -39,6 +41,7 @@ or {{< tour-map 39c3 >}}. {{- $tours = $tours | append (dict "title" $title "url" $url + "fewseats" $fewSeats "lat" .lat "lon" .lon "color" ($tour.color | default "") @@ -71,6 +74,7 @@ or {{< tour-map 39c3 >}}. {{- range $tours }}
  • {{- if .url }}{{ .title }}{{ else }}{{ .title }}{{ end }} +{{- if .fewseats }} {{ partial "fewseats-badge.html" dict }}{{ end }} ({{ i18n "tour_map_osm" }}) {{- with .directions }}{{ . }}{{ end }}
  • diff --git a/themes/hackertours/layouts/summary.html b/themes/hackertours/layouts/summary.html index 58ec9b8..a4e8044 100644 --- a/themes/hackertours/layouts/summary.html +++ b/themes/hackertours/layouts/summary.html @@ -4,7 +4,7 @@ {{- if .Param "showPostDate" | default false }} {{- $postDate = .Params.date.Format .Site.Params.dateFormat }} {{- end }} -

    {{ .Title }}

    +

    {{ .Title }}{{ if eq .Params.fewseats true }} {{ partial "fewseats-badge.html" (dict "class" "fewseats-badge--title") }}{{ end }}

    {{ if $.Param "submitted" | default false }}{{ partial "submitted.html" . -}}{{ end }}