Skip to content

Commit b7d83ee

Browse files
committed
fix: update booking-links template
1 parent a7ed077 commit b7d83ee

5 files changed

Lines changed: 43 additions & 51 deletions

File tree

i18n/de.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ booking:
1313
not-bookable: nicht buchbar
1414
reservation: Reservierung
1515
reservation-costs: Reservierungskosten
16-
send-mail-fip-50-ticket: Mail senden (FIP 50 Ticket)
17-
send-mail-fip-global-fare: Mail senden (FIP Globalpreis)
18-
send-mail-reservation: Mail senden (Reservierung)
16+
send-mail: E-Mail senden
1917
visit-additional-information-website: Weitere Informationen
2018
visit-booking-website: Zur Buchungsseite
2119
contact:

i18n/en.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ booking:
1313
not-bookable: not bookable
1414
reservation: Reservation
1515
reservation-costs: Reservation Costs
16-
send-mail-fip-50-ticket: Send email (FIP 50 Ticket)
17-
send-mail-fip-global-fare: Send email (FIP Global Fare)
18-
send-mail-reservation: Send email (Reservation)
16+
send-mail: Send email
1917
visit-additional-information-website: Additional Information
2018
visit-booking-website: To Booking Website
2119
contact:

i18n/fr.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ booking:
1313
not-bookable: non réservable
1414
reservation: Réservation
1515
reservation-costs: Frais de réservation
16-
send-mail-fip-50-ticket: Envoyer un e-mail (Billet FIP 50)
17-
send-mail-fip-global-fare: Envoyer un e-mail (Tarif Global FIP)
18-
send-mail-reservation: Envoyer un e-mail (Réservation)
16+
send-mail: Envoyer un e-mail
1917
visit-additional-information-website: Informations complémentaires
2018
visit-booking-website: Aller sur le site de réservation
2119
contact:
Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
1-
{{- $emailTemplates := .Params.email_templates -}}
2-
{{- $fip50Email := and $emailTemplates (index $emailTemplates "fip_50") -}}
3-
{{- $globalFareEmail := and $emailTemplates (index $emailTemplates "fip_global_fare") -}}
4-
{{- $reservationEmail := and $emailTemplates (index $emailTemplates "reservations") -}}
5-
{{- $showGlobalFareEmailButton := and (eq .Params.type "email") (eq .Params.fip_global_fare true) $globalFareEmail $globalFareEmail.to $globalFareEmail.subject $globalFareEmail.body -}}
6-
{{- $showFip50EmailButton := and (eq .Params.type "email") (eq .Params.fip_50 true) $fip50Email $fip50Email.to $fip50Email.subject $fip50Email.body -}}
7-
{{- $showReservationEmailButton := and (eq .Params.type "email") (eq .Params.reservations true) $reservationEmail $reservationEmail.to $reservationEmail.subject $reservationEmail.body -}}
8-
{{- if or .Params.booking_link .Params.additional_info_link $showGlobalFareEmailButton $showFip50EmailButton $showReservationEmailButton -}}
1+
{{- $params := .params -}}
2+
{{- $emailTemplates := $params.email_templates -}}
3+
{{- $emailTypes := slice "fip_50" "fip_75" "fip_global_fare" "reservations" -}}
4+
{{- $emailButtons := slice -}}
5+
{{- range $emailType := $emailTypes -}}
6+
{{- $metaMatches := where $.metaFields "key" $emailType -}}
7+
{{- $metaValue := false -}}
8+
{{- $metaLabel := "" -}}
9+
{{- if gt (len $metaMatches) 0 -}}
10+
{{- $metaValue = (index $metaMatches 0).value -}}
11+
{{- $metaLabel = (index $metaMatches 0).label -}}
12+
{{- end -}}
13+
{{- $template := and $emailTemplates (index $emailTemplates $emailType) -}}
14+
{{- $showEmailButton := and (eq $params.type "email") (eq $metaValue true) $template $template.to $template.subject $template.body -}}
15+
{{- if $showEmailButton -}}
16+
{{- $buttonText := T "booking.send-mail" -}}
17+
{{- if $metaLabel -}}
18+
{{- $buttonText = printf "%s (%s)" (T "booking.send-mail") (T $metaLabel) -}}
19+
{{- end -}}
20+
{{- $emailButtons = $emailButtons | append (dict
21+
"Destination" (printf "mailto:%s?subject=%s&body=%s" $template.to (replace ($template.subject | urlquery) "+" "%20") (replace ($template.body | urlquery) "+" "%20"))
22+
"Text" $buttonText
23+
)
24+
-}}
25+
{{- end -}}
26+
{{- end -}}
27+
{{- if or $params.booking_link $params.additional_info_link (gt (len $emailButtons) 0) -}}
928
<div class="o-booking__links">
10-
{{- if .Params.booking_link -}}
29+
{{- if $params.booking_link -}}
1130
{{- partial "button"
1231
(dict
13-
"Destination" .Params.booking_link
32+
"Destination" $params.booking_link
1433
"Text" (T "booking.visit-booking-website")
1534
)
1635
-}}
1736
{{- end -}}
18-
{{- if .Params.additional_info_link -}}
37+
{{- if $params.additional_info_link -}}
1938
{{- partial "button"
2039
(dict
21-
"Destination" .Params.additional_info_link
40+
"Destination" $params.additional_info_link
2241
"Text" (T "booking.visit-additional-information-website")
2342
)
2443
-}}
2544
{{- end -}}
26-
{{- if $showGlobalFareEmailButton -}}
27-
{{- partial "button"
28-
(dict
29-
"Destination" (printf "mailto:%s?subject=%s&body=%s" $globalFareEmail.to (replace ($globalFareEmail.subject | urlquery) "+" "%20") (replace ($globalFareEmail.body | urlquery) "+" "%20"))
30-
"Text" (T "booking.send-mail-fip-global-fare")
31-
)
32-
-}}
33-
{{- end -}}
34-
{{- if $showFip50EmailButton -}}
35-
{{- partial "button"
36-
(dict
37-
"Destination" (printf "mailto:%s?subject=%s&body=%s" $fip50Email.to (replace ($fip50Email.subject | urlquery) "+" "%20") (replace ($fip50Email.body | urlquery) "+" "%20"))
38-
"Text" (T "booking.send-mail-fip-50-ticket")
39-
)
40-
-}}
41-
{{- end -}}
42-
{{- if $showReservationEmailButton -}}
43-
{{- partial "button"
44-
(dict
45-
"Destination" (printf "mailto:%s?subject=%s&body=%s" $reservationEmail.to (replace ($reservationEmail.subject | urlquery) "+" "%20") (replace ($reservationEmail.body | urlquery) "+" "%20"))
46-
"Text" (T "booking.send-mail-reservation")
47-
)
48-
-}}
45+
{{- range $emailButtons -}}
46+
{{- partial "button" . -}}
4947
{{- end -}}
5048
</div>
5149
{{- end -}}

layouts/partials/booking.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{{- $iconMapping := dict "website" "computer" "phone" "call" "onsite" "person" "email" "mail" "machine" "confirmation_number" "socialmedia" "add_reaction" -}}
2+
{{- $metaFields := slice
3+
(dict "key" "reservations" "value" .reservations "label" "booking.reservation")
4+
(dict "key" "fip_50" "value" .fip_50 "label" "booking.fip-50")
5+
(dict "key" "fip_75" "value" .fip_75 "label" "booking.fip-75")
6+
(dict "key" "fip_global_fare" "value" .fip_global_fare "label" "booking.fip-global-fare")
7+
-}}
28
<summary class="o-expander__summary o-expander__summary--booking">
39
<div class="o-booking__header-content">
410
<div class="o-booking__title-wrapper">
@@ -12,12 +18,6 @@
1218
</div>
1319
{{- end }}
1420
<div class="o-booking__meta">
15-
{{- $metaFields := slice
16-
(dict "key" "reservations" "value" .reservations "label" "booking.reservation")
17-
(dict "key" "fip_50" "value" .fip_50 "label" "booking.fip-50")
18-
(dict "key" "fip_75" "value" .fip_75 "label" "booking.fip-75")
19-
(dict "key" "fip_global_fare" "value" .fip_global_fare "label" "booking.fip-global-fare")
20-
-}}
2121
{{- range $metaFields -}}
2222
{{- if ne .value "nil" -}}
2323
{{- if .value -}}
@@ -71,5 +71,5 @@
7171
{{- $content | safeHTML -}}
7272
</div>
7373

74-
{{ partial "booking-links" .page }}
74+
{{- partial "booking-links" (dict "params" .page.Params "metaFields" $metaFields) -}}
7575
</div>

0 commit comments

Comments
 (0)