cannery/lib/cannery_web/controllers/email_controller.ex

25 lines
603 B
Elixir
Raw Normal View History

2022-02-17 21:47:37 -05:00
defmodule CanneryWeb.EmailController do
@moduledoc """
A dev controller used to develop on emails
"""
use CanneryWeb, :controller
alias Cannery.Accounts.User
2023-04-14 23:34:11 -04:00
plug :put_root_layout, html: {CanneryWeb.Layouts, :email_html}
plug :put_layout, false
2022-02-17 21:47:37 -05:00
@sample_assigns %{
email: %{subject: "Example subject"},
url: "https://cannery.bubbletea.dev/sample_url",
user: %User{email: "sample@email.com"}
}
@doc """
Debug route used to preview emails
"""
def preview(conn, %{"id" => template}) do
2023-04-14 23:34:11 -04:00
render(conn, String.to_existing_atom(template), @sample_assigns)
2022-02-17 21:47:37 -05:00
end
end