Compare commits

..

2 Commits

Author SHA1 Message Date
35de8a6395 use embed templates suffix
All checks were successful
continuous-integration/drone/push Build is passing
2023-04-14 18:45:12 -04:00
96e155a49a ee cummings more emails 2023-04-14 18:29:34 -04:00
13 changed files with 142 additions and 141 deletions

View File

@ -28,21 +28,21 @@ defmodule Memex.Email do
@spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t() @spec generate_email(key :: String.t(), User.t(), attrs :: map()) :: t()
def generate_email("welcome", user, %{"url" => url}) do def generate_email("welcome", user, %{"url" => url}) do
user user
|> base_email(dgettext("emails", "Confirm your Memex account")) |> base_email(dgettext("emails", "confirm your memEx account"))
|> html_email(:confirm_email_html, %{user: user, url: url}) |> html_email(:confirm_email_html, %{user: user, url: url})
|> text_email(:confirm_email_text, %{user: user, url: url}) |> text_email(:confirm_email_text, %{user: user, url: url})
end end
def generate_email("reset_password", user, %{"url" => url}) do def generate_email("reset_password", user, %{"url" => url}) do
user user
|> base_email(dgettext("emails", "Reset your Memex password")) |> base_email(dgettext("emails", "reset your memEx password"))
|> html_email(:reset_password_html, %{user: user, url: url}) |> html_email(:reset_password_html, %{user: user, url: url})
|> text_email(:reset_password_text, %{user: user, url: url}) |> text_email(:reset_password_text, %{user: user, url: url})
end end
def generate_email("update_email", user, %{"url" => url}) do def generate_email("update_email", user, %{"url" => url}) do
user user
|> base_email(dgettext("emails", "Update your Memex email")) |> base_email(dgettext("emails", "update your memEx email"))
|> html_email(:update_email_html, %{user: user, url: url}) |> html_email(:update_email_html, %{user: user, url: url})
|> text_email(:update_email_text, %{user: user, url: url}) |> text_email(:update_email_text, %{user: user, url: url})
end end

View File

@ -10,7 +10,7 @@
<hr style="margin: 2em auto; border-width: 1px; border-color: rgb(161, 161, 170); width: 100%; max-width: 42rem;" /> <hr style="margin: 2em auto; border-width: 1px; border-color: rgb(161, 161, 170); width: 100%; max-width: 42rem;" />
<a style="color: rgb(161, 161, 170);" href={~p"/"}> <a style="color: rgb(161, 161, 170);" href={~p"/"}>
<%= dgettext("emails", "This email was sent from memEx") %> <%= dgettext("emails", "this email was sent from memEx") %>
</a> </a>
</body> </body>
</html> </html>

View File

@ -6,4 +6,4 @@
===================== =====================
<%= dgettext("emails", "This email was sent from memEx at %{url}", url: ~p"/") %> <%= dgettext("emails", "this email was sent from memEx at %{url}", url: ~p"/") %>

View File

@ -5,5 +5,6 @@ defmodule MemexWeb.EmailHTML do
use MemexWeb, :html use MemexWeb, :html
embed_templates "email_html/*" embed_templates "email_html/*.html", suffix: "_html"
embed_templates "email_html/*.txt", suffix: "_text"
end end

View File

@ -10,83 +10,83 @@ msgid ""
msgstr "" msgstr ""
"Language: de\n" "Language: de\n"
#: lib/memex/accounts/email.ex:31 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:3
#, elixir-autogen, elixir-format #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:2
msgid "Confirm your Memex account" #: lib/memex_web/controllers/email_html/reset_password.html.heex:3
msgstr "" #: lib/memex_web/controllers/email_html/reset_password.txt.eex:2
#: lib/memex_web/controllers/email_html/update_email.html.heex:3
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:3 #: lib/memex_web/controllers/email_html/update_email.txt.eex:2
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:2
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:3
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:2
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:3
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:2
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Hi %{email}," msgid "Hi %{email},"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:10 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:10
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't create an account at %{url}, please ignore this." msgid "If you didn't create an account at %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:8 #: lib/memex_web/controllers/email_html/reset_password.txt.eex:8
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:8 #: lib/memex_web/controllers/email_html/update_email.txt.eex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from %{url}, please ignore this." msgid "If you didn't request this change from %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex/accounts/email.ex:38 #: lib/memex_web/controllers/email_html/update_email.html.heex:8
#, elixir-autogen, elixir-format #: lib/memex_web/controllers/email_html/update_email.txt.eex:4
msgid "Reset your Memex password"
msgstr ""
#: lib/memex/accounts/email.ex:45
#, elixir-autogen, elixir-format
msgid "Update your Memex email"
msgstr ""
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:8
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can change your email by visiting the URL below:" msgid "You can change your email by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:14 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:14
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:6 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:6
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can confirm your account by visiting the URL below:" msgid "You can confirm your account by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:8 #: lib/memex_web/controllers/email_html/reset_password.html.heex:8
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:4 #: lib/memex_web/controllers/email_html/reset_password.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can reset your password by visiting the URL below:" msgid "You can reset your password by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/components/layouts/email_html.html.heex:13 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:22
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx"
msgstr ""
#: lib/memex_web/components/layouts/email_text.txt.eex:9
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx at %{url}"
msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:22
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "If you didn't create an account at memEx, please ignore this." msgid "If you didn't create an account at memEx, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:16 #: lib/memex_web/controllers/email_html/reset_password.html.heex:16
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:16 #: lib/memex_web/controllers/email_html/update_email.html.heex:16
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "If you didn't request this change from memEx, please ignore this." msgid "If you didn't request this change from memEx, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:9 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:9
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:4 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:4
#, elixir-autogen, elixir-format, fuzzy #, elixir-autogen, elixir-format, fuzzy
msgid "Welcome to memEx" msgid "Welcome to memEx"
msgstr "" msgstr ""
#: lib/memex/accounts/email.ex:31
#, elixir-autogen, elixir-format, fuzzy
msgid "confirm your memEx account"
msgstr ""
#: lib/memex/accounts/email.ex:38
#, elixir-autogen, elixir-format, fuzzy
msgid "reset your memEx password"
msgstr ""
#: lib/memex_web/components/layouts/email_html.html.heex:13
#, elixir-autogen, elixir-format, fuzzy
msgid "this email was sent from memEx"
msgstr ""
#: lib/memex_web/components/layouts/email_text.txt.eex:9
#, elixir-autogen, elixir-format, fuzzy
msgid "this email was sent from memEx at %{url}"
msgstr ""
#: lib/memex/accounts/email.ex:45
#, elixir-autogen, elixir-format, fuzzy
msgid "update your memEx email"
msgstr ""

View File

@ -10,83 +10,83 @@
msgid "" msgid ""
msgstr "" msgstr ""
#: lib/memex/accounts/email.ex:31 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:3
#, elixir-autogen, elixir-format #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:2
msgid "Confirm your Memex account" #: lib/memex_web/controllers/email_html/reset_password.html.heex:3
msgstr "" #: lib/memex_web/controllers/email_html/reset_password.txt.eex:2
#: lib/memex_web/controllers/email_html/update_email.html.heex:3
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:3 #: lib/memex_web/controllers/email_html/update_email.txt.eex:2
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:2
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:3
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:2
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:3
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:2
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Hi %{email}," msgid "Hi %{email},"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:10 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:10
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't create an account at %{url}, please ignore this." msgid "If you didn't create an account at %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:8 #: lib/memex_web/controllers/email_html/reset_password.txt.eex:8
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:8 #: lib/memex_web/controllers/email_html/update_email.txt.eex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from %{url}, please ignore this." msgid "If you didn't request this change from %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex/accounts/email.ex:38 #: lib/memex_web/controllers/email_html/update_email.html.heex:8
#, elixir-autogen, elixir-format #: lib/memex_web/controllers/email_html/update_email.txt.eex:4
msgid "Reset your Memex password"
msgstr ""
#: lib/memex/accounts/email.ex:45
#, elixir-autogen, elixir-format
msgid "Update your Memex email"
msgstr ""
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:8
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can change your email by visiting the URL below:" msgid "You can change your email by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:14 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:14
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:6 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:6
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can confirm your account by visiting the URL below:" msgid "You can confirm your account by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:8 #: lib/memex_web/controllers/email_html/reset_password.html.heex:8
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:4 #: lib/memex_web/controllers/email_html/reset_password.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can reset your password by visiting the URL below:" msgid "You can reset your password by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/components/layouts/email_html.html.heex:13 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:22
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx"
msgstr ""
#: lib/memex_web/components/layouts/email_text.txt.eex:9
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx at %{url}"
msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't create an account at memEx, please ignore this." msgid "If you didn't create an account at memEx, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:16 #: lib/memex_web/controllers/email_html/reset_password.html.heex:16
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:16 #: lib/memex_web/controllers/email_html/update_email.html.heex:16
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from memEx, please ignore this." msgid "If you didn't request this change from memEx, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:9 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:9
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:4 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Welcome to memEx" msgid "Welcome to memEx"
msgstr "" msgstr ""
#: lib/memex/accounts/email.ex:31
#, elixir-autogen, elixir-format
msgid "confirm your memEx account"
msgstr ""
#: lib/memex/accounts/email.ex:38
#, elixir-autogen, elixir-format
msgid "reset your memEx password"
msgstr ""
#: lib/memex_web/components/layouts/email_html.html.heex:13
#, elixir-autogen, elixir-format
msgid "this email was sent from memEx"
msgstr ""
#: lib/memex_web/components/layouts/email_text.txt.eex:9
#, elixir-autogen, elixir-format
msgid "this email was sent from memEx at %{url}"
msgstr ""
#: lib/memex/accounts/email.ex:45
#, elixir-autogen, elixir-format
msgid "update your memEx email"
msgstr ""

View File

@ -11,83 +11,83 @@ msgstr ""
"Language: en\n" "Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: lib/memex/accounts/email.ex:31 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:3
#, elixir-autogen, elixir-format #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:2
msgid "Confirm your Memex account" #: lib/memex_web/controllers/email_html/reset_password.html.heex:3
msgstr "" #: lib/memex_web/controllers/email_html/reset_password.txt.eex:2
#: lib/memex_web/controllers/email_html/update_email.html.heex:3
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:3 #: lib/memex_web/controllers/email_html/update_email.txt.eex:2
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:2
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:3
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:2
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:3
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:2
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Hi %{email}," msgid "Hi %{email},"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:10 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:10
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't create an account at %{url}, please ignore this." msgid "If you didn't create an account at %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:8 #: lib/memex_web/controllers/email_html/reset_password.txt.eex:8
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:8 #: lib/memex_web/controllers/email_html/update_email.txt.eex:8
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from %{url}, please ignore this." msgid "If you didn't request this change from %{url}, please ignore this."
msgstr "" msgstr ""
#: lib/memex/accounts/email.ex:38 #: lib/memex_web/controllers/email_html/update_email.html.heex:8
#, elixir-autogen, elixir-format #: lib/memex_web/controllers/email_html/update_email.txt.eex:4
msgid "Reset your Memex password"
msgstr ""
#: lib/memex/accounts/email.ex:45
#, elixir-autogen, elixir-format
msgid "Update your Memex email"
msgstr ""
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:8
#: lib/memex_web/controllers/email_html/update_email_text.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can change your email by visiting the URL below:" msgid "You can change your email by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:14 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:14
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:6 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:6
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can confirm your account by visiting the URL below:" msgid "You can confirm your account by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:8 #: lib/memex_web/controllers/email_html/reset_password.html.heex:8
#: lib/memex_web/controllers/email_html/reset_password_text.txt.eex:4 #: lib/memex_web/controllers/email_html/reset_password.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "You can reset your password by visiting the URL below:" msgid "You can reset your password by visiting the URL below:"
msgstr "" msgstr ""
#: lib/memex_web/components/layouts/email_html.html.heex:13 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:22
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx"
msgstr ""
#: lib/memex_web/components/layouts/email_text.txt.eex:9
#, elixir-autogen, elixir-format
msgid "This email was sent from memEx at %{url}"
msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:22
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't create an account at memEx, please ignore this." msgid "If you didn't create an account at memEx, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/reset_password_html.html.heex:16 #: lib/memex_web/controllers/email_html/reset_password.html.heex:16
#: lib/memex_web/controllers/email_html/update_email_html.html.heex:16 #: lib/memex_web/controllers/email_html/update_email.html.heex:16
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "If you didn't request this change from memEx, please ignore this." msgid "If you didn't request this change from memEx, please ignore this."
msgstr "" msgstr ""
#: lib/memex_web/controllers/email_html/confirm_email_html.html.heex:9 #: lib/memex_web/controllers/email_html/confirm_email.html.heex:9
#: lib/memex_web/controllers/email_html/confirm_email_text.txt.eex:4 #: lib/memex_web/controllers/email_html/confirm_email.txt.eex:4
#, elixir-autogen, elixir-format #, elixir-autogen, elixir-format
msgid "Welcome to memEx" msgid "Welcome to memEx"
msgstr "" msgstr ""
#: lib/memex/accounts/email.ex:31
#, elixir-autogen, elixir-format, fuzzy
msgid "confirm your memEx account"
msgstr ""
#: lib/memex/accounts/email.ex:38
#, elixir-autogen, elixir-format, fuzzy
msgid "reset your memEx password"
msgstr ""
#: lib/memex_web/components/layouts/email_html.html.heex:13
#, elixir-autogen, elixir-format, fuzzy
msgid "this email was sent from memEx"
msgstr ""
#: lib/memex_web/components/layouts/email_text.txt.eex:9
#, elixir-autogen, elixir-format, fuzzy
msgid "this email was sent from memEx at %{url}"
msgstr ""
#: lib/memex/accounts/email.ex:45
#, elixir-autogen, elixir-format, fuzzy
msgid "update your memEx email"
msgstr ""