cannery/lib/cannery_web/controllers/email_controller.ex

24 lines
564 B
Elixir
Raw Normal View History

2023-02-25 15:47:37 -05:00
defmodule CanneryWeb.EmailController do
2022-02-25 21:53:04 -05:00
@moduledoc """
A dev controller used to develop on emails
"""
2023-02-25 15:47:37 -05:00
use CanneryWeb, :controller
alias Cannery.Accounts.User
2022-02-25 21:53:04 -05:00
2023-02-25 15:47:37 -05:00
plug :put_layout, {CanneryWeb.LayoutView, :email}
2022-02-25 21:53:04 -05:00
@sample_assigns %{
email: %{subject: "Example subject"},
2023-02-25 15:47:37 -05:00
url: "https://cannery.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
render(conn, "#{template |> to_string()}.html", @sample_assigns)
end
end