feat: add email booking mail templates#999
Conversation
✅ Deploy Preview for fipguide ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| @@ -1,4 +1,9 @@ | |||
| {{- if or .Params.booking_link .Params.additional_info_link -}} | |||
| {{- $mailTemplates := .Params.mail_templates -}} | |||
There was a problem hiding this comment.
Müsste eher email_templates sein, mail steht im Englischen für Briefpost.
MoritzWeber0
left a comment
There was a problem hiding this comment.
Cool idea! In the future we could even try to build a form where users can fill the placeholder fields and then send it via email :)
| "Text" (T "booking.send-mail-reservation") | ||
| ) | ||
| -}} | ||
| {{- end -}} |
There was a problem hiding this comment.
This can be better solved with a for loop by iterating over fip_50, fip_75, fip_global_fare and reservations.
The variables $Xemail and $showXEmailButton can be defined in the loop body. We also don't need separate translation keys for each different email type as it doesn't differ from the original translation. So (T "booking.send-mail") + "(" + (T "booking.reservation") + ")" is already sufficient.
In the booking partial we already have a variable $metaFields the we can iterate over. We could just pass it to the booking-links partial and reuse it there. Currently, we don't pass a dict to the booking-links partial, but this will change in #856 anyway.
| {{- $globalFareEmail := and $emailTemplates (index $emailTemplates "fip_global_fare") -}} | ||
| {{- $reservationEmail := and $emailTemplates (index $emailTemplates "reservations") -}} | ||
| {{- $showGlobalFareEmailButton := and (eq .Params.type "email") (eq .Params.fip_global_fare true) $globalFareEmail $globalFareEmail.to $globalFareEmail.subject $globalFareEmail.body -}} | ||
| {{- $showFip50EmailButton := and (eq .Params.type "email") (eq .Params.fip_50 true) $fip50Email $fip50Email.to $fip50Email.subject $fip50Email.body -}} |
There was a problem hiding this comment.
Already better than before, but it still doesn't consider the attributes passed to the shortcode. For example, "International Rail Ltd. Email" on the Eurostar page still shows the the fip_50 email option, even though it's set as fip_50=nil in the attributes.
If you use the $metaFields as described in the other comment, you can "value" key of the dict to access the passed attribute.
What
params.mail_templatesso each booking way has its own subject/body/recipient%20instead of+)Included booking pages
content/booking/attica-email/index.de.mdcontent/booking/attica-email/index.en.mdcontent/booking/attica-email/index.fr.mdcontent/booking/ffestiniogtravel-email/index.de.mdcontent/booking/ffestiniogtravel-email/index.en.mdcontent/booking/ffestiniogtravel-email/index.fr.mdcontent/booking/internationalrail-email/index.de.mdcontent/booking/internationalrail-email/index.en.mdcontent/booking/internationalrail-email/index.fr.mdcontent/booking/stena-line-bv-email/index.de.mdcontent/booking/stena-line-bv-email/index.en.mdcontent/booking/stena-line-bv-email/index.fr.mdcontent/booking/stena-line-limited-email/index.de.mdcontent/booking/stena-line-limited-email/index.en.mdcontent/booking/stena-line-limited-email/index.fr.mdTemplate/i18n changes
layouts/partials/booking-links.htmllayouts/partials/button.htmli18n/de.yamli18n/en.yamli18n/fr.yamlDepends on #998
Fixes #995