analytics/lib/plausible_web/views/email_view.ex
2022-11-10 16:45:43 +02:00

22 lines
436 B
Elixir

defmodule PlausibleWeb.EmailView do
use PlausibleWeb, :view
def plausible_url do
PlausibleWeb.Endpoint.url()
end
def base_domain() do
PlausibleWeb.Endpoint.host()
end
def greet_recipient(%{user: %{name: name}}) when is_binary(name) do
"Hey #{String.split(name) |> List.first()},"
end
def greet_recipient(_), do: "Hey,"
def date_format(date) do
Timex.format!(date, "{D} {Mshort} {YYYY}")
end
end