Use a pill with explicit links for iCal and Google Calendar.
This commit is contained in:
parent
1ff57e8c7a
commit
443ae1e05d
9 changed files with 34 additions and 40 deletions
|
|
@ -1,4 +0,0 @@
|
|||
{{- /* Script for the calendar shortcode, included by the base templates on pages that use it. */ -}}
|
||||
{{- with resources.Get "js/calendar.js" | minify | fingerprint -}}
|
||||
<script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" defer></script>
|
||||
{{- end -}}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{{- /*
|
||||
Calendar link for one date of a tour, shown as a calendar icon: an .ics file (iCalendar), which
|
||||
Apple Calendar, Outlook, Thunderbird and most other calendar apps can open. On Android,
|
||||
assets/js/calendar.js turns it into a link that adds the date in Google Calendar.
|
||||
Calendar links for one date of a tour, in a small pill with a calendar icon: an .ics file
|
||||
(iCalendar), which Apple Calendar, Outlook, Thunderbird and most other calendar apps can open,
|
||||
and a link that adds the date in Google Calendar, whose Android app can't open .ics files.
|
||||
Meant for the list of dates on a tour page:
|
||||
|
||||
* Tag 1 (27.12.) **17:30 Uhr** {{< calendar date="2026-12-27" time="17:30" duration="210" >}}
|
||||
|
|
@ -71,9 +71,8 @@ title of this date in the schedule data, else the page title).
|
|||
|
||||
{{- $file := printf "%s-%s-%s.ics" $slug $date (replace $time ":" "") -}}
|
||||
{{- $icsFile := resources.FromString (path.Join (strings.TrimPrefix "/" $page.RelPermalink) $file) $ics -}}
|
||||
{{- /* The icon is the same for every date, so the link name for screen readers includes the date. */ -}}
|
||||
{{- /* The link texts are the same for every date, so their names for screen readers include the date. */ -}}
|
||||
{{- $when := printf "%s %s" ($start | time.Format "Mon 2.1.") $time -}}
|
||||
{{- /* Android's Google Calendar app can't open .ics files; there, calendar.js uses this link instead. */ -}}
|
||||
{{- $google := printf "https://calendar.google.com/calendar/render?%s" (querify
|
||||
"action" "TEMPLATE"
|
||||
"text" $title
|
||||
|
|
@ -82,5 +81,8 @@ title of this date in the schedule data, else the page title).
|
|||
"location" $location
|
||||
"ctz" "Europe/Berlin"
|
||||
) -}}
|
||||
<a class="tour-calendar" href="{{ $icsFile.RelPermalink }}" download="{{ $file }}" title="{{ i18n "calendar_ics" }}" data-google-href="{{ $google }}" data-google-title="{{ i18n "calendar_google" }}" data-google-label="{{ i18n "calendar_google" }} {{ $when }}">{{ partial "fa-icon.html" "regular/calendar-plus" }}<span class="visually-hidden">{{ i18n "calendar_ics" }} {{ $when }}</span></a>
|
||||
<span class="tour-calendar">{{ partial "fa-icon.html" "regular/calendar-plus" -}}
|
||||
<a href="{{ $icsFile.RelPermalink }}" download="{{ $file }}">{{ i18n "calendar_ics" }}<span class="visually-hidden"> {{ $when }}</span></a>
|
||||
{{- /* */ -}}<span class="tour-calendar__separator" aria-hidden="true">|</span>
|
||||
{{- /* */ -}}<a href="{{ $google }}">{{ i18n "calendar_google" }}<span class="visually-hidden"> {{ $when }}</span></a></span>
|
||||
{{- /* chomp */ -}}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
{{ block "head" . }}{{ end }}
|
||||
{{ if .HasShortcode "schedule" }}{{ partial "schedule-script.html" . }}{{ end }}
|
||||
{{ if .HasShortcode "tour-map" }}{{ partial "tour-map-script.html" . }}{{ end }}
|
||||
{{ if .HasShortcode "calendar" }}{{ partial "calendar-script.html" . }}{{ end }}
|
||||
</head>
|
||||
|
||||
<body class="{{ if .IsPage }}single-page{{ else }}list-page{{ end }}{{ if .IsHome }} front{{ end }}{{ with .Section }} section-page--{{ . | urlize }}{{ end }}{{ with $.Param "bodyclass" }} {{ . }}{{ end }}">
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
{{ block "head" . }}{{ end }}
|
||||
{{ if .HasShortcode "schedule" }}{{ partial "schedule-script.html" . }}{{ end }}
|
||||
{{ if .HasShortcode "tour-map" }}{{ partial "tour-map-script.html" . }}{{ end }}
|
||||
{{ if .HasShortcode "calendar" }}{{ partial "calendar-script.html" . }}{{ end }}
|
||||
</head>
|
||||
|
||||
<body class="{{ if .IsPage }}single-page{{ else }}list-page{{ end }}{{ if .IsHome }} front{{ end }}{{ with .Section }} section-page--{{ . | urlize }}{{ end }}{{ with $.Param "bodyclass" }} {{ . }}{{ end }}">
|
||||
|
|
|
|||
Loading…
Reference in a new issue