memEx/lib/memex_web/controllers/email_controller.ex

25 lines
593 B
Elixir
Raw Permalink Normal View History

2022-07-25 19:31:54 -04:00
defmodule MemexWeb.EmailController do
2022-02-25 21:53:04 -05:00
@moduledoc """
A dev controller used to develop on emails
"""
2022-07-25 19:31:54 -04:00
use MemexWeb, :controller
alias Memex.Accounts.User
2022-02-25 21:53:04 -05:00
2023-04-13 23:29:29 -04:00
plug :put_root_layout, html: {MemexWeb.Layouts, :email_html}
plug :put_layout, false
2022-02-25 21:53:04 -05:00
@sample_assigns %{
email: %{subject: "Example subject"},
2022-07-25 19:31:54 -04:00
url: "https://memex.bubbletea.dev/sample_url",
2022-02-25 21:53:04 -05:00
user: %User{email: "sample@email.com"}
}
@doc """
Debug route used to preview emails
"""
def preview(conn, %{"id" => template}) do
2023-04-13 23:29:29 -04:00
render(conn, String.to_existing_atom(template), @sample_assigns)
2022-02-25 21:53:04 -05:00
end
end