howdy/mail/preview
Named examples of your emails, built from sample data, for the admin area to render without running the flow that sends them.
pub fn previews() -> List(preview.Preview) {
[
preview.new("Welcome", fn() { emails.welcome(sample_user()) }),
preview.new("Invoice", fn() { emails.invoice(sample_invoice()) })
|> preview.in_group("Billing"),
]
}
A preview is built each time it is shown, so with howdy/dev an edited
template shows on the next refresh.
Types
Values
pub fn build(preview: Preview) -> Result(mail.Message, String)
Build the message. A template that panics or crashes on the sample data
gives Error with the reason instead.
pub fn find(
previews: List(Preview),
wanted: String,
) -> Result(Preview, Nil)
The preview with this key.
pub fn key(preview: Preview) -> String
A URL-safe key for the preview, from its group and name.
pub fn new(name: String, build: fn() -> mail.Message) -> Preview
A preview in the group “Emails”.