debianize-mobilizon/lib/web/templates/email/event_updated.text.eex
Thomas Citharel a9e36aaacb
Show correct timezone in event-related emails
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2021-10-18 11:13:33 +02:00

30 lines
2.3 KiB
Elixir

<%= gettext "Event update!" %>
==
<%= gettext "There have been changes for %{title} so we'd thought we'd let you know.", title: @old_event.title %>
<%= if MapSet.member?(@changes, :status) do %>
<%= case @event.status do %>
<% :confirmed -> %>
<%= gettext "This event has been confirmed" %>
<% :tentative -> %>
<%= gettext "This event has yet to be confirmed: organizers will let you know if they do confirm it." %>
<% :cancelled -> %>
<%= gettext "This event has been cancelled by its organizers. Sorry!" %>
<% end %>
<% end %>
<%= if MapSet.member?(@changes, :title) do %>
<%= gettext "New title: %{title}", title: @event.title %>
<% end %>
<%= if MapSet.member?(@changes, :begins_on) do %><%= cond do %><% @event.options.timezone != nil and @event.options.timezone != @timezone -> %><%# Event with different timezone than user %>
<%= gettext "Start %{begins_on} (🌐 %{timezone} %{offset})", begins_on: @event.begins_on |> datetime_tz_convert(@event.options.timezone) |> datetime_to_string(@locale), timezone: @event.options.timezone, offset: @event.begins_on |> datetime_tz_convert(@event.options.timezone) |> Cldr.DateTime.Formatter.zone_gmt() %>
<%# Event with same timezone than user %><% @event.options.timezone != nil and @event.options.timezone == @timezone -> %>
<%= gettext "Start %{begins_on} (your timezone)", begins_on: @event.begins_on |> datetime_tz_convert(@event.options.timezone) |> datetime_to_string(@locale) %>
<%# Event with no timezone (show in user timezone) %><% true -> %>
<%= gettext "Start %{begins_on}", begins_on: @event.begins_on |> datetime_tz_convert(@timezone) |> datetime_to_string(@locale) %>
<% end %>
<% end %>
<%= if MapSet.member?(@changes, :ends_on) && !is_nil(@event.ends_on) do %>
<%= gettext "End %{ends_on}", ends_on: @event.ends_on |> datetime_tz_convert(@timezone) |> datetime_to_string(@locale) %>
<% end %>
<%= gettext "Visit the updated event page: %{link}", link: Routes.page_url(Mobilizon.Web.Endpoint, :event, @event.uuid) %>
<%= ngettext "Would you wish to cancel your attendance, visit the event page through the link above and click the « Attending » button.", "Would you wish to cancel your attendance to one or several events, visit the event pages through the links above and click the « Attending » button.", 1 %>