Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make simpler email template #104

Merged
merged 2 commits into from
Oct 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions backend/Rhyolite/Backend/Email.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,16 @@ sendEmailFrom name' email recipients sub body =
deriveNewtypePersistBackend (\m -> [t| EmailT $m |]) (\m -> [t| ReaderT EmailEnv $m |]) 'EmailT 'unEmailT

emailTemplate :: (MonadRoute r m, Default r) => Text -> Maybe Html -> Html -> Html -> Html -> m Html
emailTemplate productName mStyleHtml titleHtml leadHtml contentHtml = do
emailTemplate productName mStyleHtml titleHtml leadHtml contentHtml =
emailTemplateSimple productName mStyleHtml titleHtml $ H.table $ do
H.tr $ H.td $ H.h1 titleHtml
H.hr
H.tr $ H.td $ H.p ! class_ "lead" $ leadHtml
H.hr
H.tr $ H.td $ contentHtml

emailTemplateSimple :: (MonadRoute r m, Default r) => Text -> Maybe Html -> Html -> Html -> m Html
emailTemplateSimple productName mStyleHtml titleHtml contentHtml = do
indexLink <- routeToUrl def
return $ H.docTypeHtml $ do
H.head $ do
Expand All @@ -117,12 +126,7 @@ emailTemplate productName mStyleHtml titleHtml leadHtml contentHtml = do
Just styleHtml -> styleHtml
H.title titleHtml
H.body $ H.table $ do
H.tr $ H.td $ H.table $ do
H.tr $ H.td $ H.h1 titleHtml
H.hr
H.tr $ H.td $ H.p ! class_ "lead" $ leadHtml
H.hr
H.tr $ H.td $ contentHtml
H.tr $ H.td $ contentHtml
H.tr $ H.td $ H.table $ H.tr $ H.td $ do
H.hr
H.p $ do
Expand Down