test(i18n): failed attempts to use i18nHamletFile for mail notifications
This commit is contained in:
parent
1ed47e677b
commit
a755bd0be6
@ -4,6 +4,7 @@ module Handler.Utils.Mail
|
||||
, userMailT
|
||||
, addFileDB
|
||||
, addHtmlMarkdownAlternatives
|
||||
, addHtmlMarkdownAlternatives'
|
||||
) where
|
||||
|
||||
import Import
|
||||
@ -120,3 +121,28 @@ addHtmlMarkdownAlternatives html' = do
|
||||
writerOptions = markdownWriterOptions
|
||||
{ P.writerReferenceLinks = True
|
||||
}
|
||||
|
||||
{-
|
||||
addHtmlMarkdownAlternatives' :: ( HandlerSite m ~ UniWorX
|
||||
, MonadMail m
|
||||
, ToMailPart (HandlerSite m) Html
|
||||
, ToMailHtml (HandlerSite m) a
|
||||
) => a -> m ()
|
||||
addHtmlMarkdownAlternatives' = addHtmlMarkdownAlternatives
|
||||
-}
|
||||
|
||||
-- For now failed attempt to use with i18nHaletFile or widgets:
|
||||
addHtmlMarkdownAlternatives' :: ( HandlerSite m ~ UniWorX
|
||||
, MonadMail m
|
||||
, YesodMail (HandlerSite m)
|
||||
) => Html -> m ()
|
||||
addHtmlMarkdownAlternatives' html = do
|
||||
markdown <- runMaybeT $ renderMarkdownWith htmlReaderOptions writerOptions html
|
||||
|
||||
addAlternatives $ do
|
||||
providePreferredAlternative html
|
||||
whenIsJust markdown provideAlternative
|
||||
where
|
||||
writerOptions = markdownWriterOptions
|
||||
{ P.writerReferenceLinks = True
|
||||
}
|
||||
|
||||
@ -52,10 +52,13 @@ dispatchNotificationQualificationRenewal nQualification jRecipient = do
|
||||
replaceMailHeader "Auto-Submitted" $ Just "auto-generated"
|
||||
setSubjectI $ MsgMailSubjectQualificationRenewal qname
|
||||
|
||||
editNotifications <- mkEditNotifications jRecipient -- TODO: add to hamlet file again
|
||||
-- addHtmlMarkdownAlternatives $(i18nWidgetFile "qualification/renewal")
|
||||
editNotifications <- mkEditNotifications jRecipient -- TODO: add to hamlet file again
|
||||
-- let msgrenewal = $(i18nHamletFile "qualification/renewal") -- :: HtmlUrlI18n (SomeMessage UniWorX) (Route UniWorX)
|
||||
-- addHtmlMarkdownAlternatives' msgrenewal
|
||||
|
||||
-- TODO: this is just a dummy to continue while i18nHamletFile usage is unclear
|
||||
addHtmlMarkdownAlternatives $(ihamletFile "templates/mail/qualificationRenewal.hamlet")
|
||||
addHtmlMarkdownAlternatives $(ihamletFile "templates/mail/qualificationRenewal.hamlet")
|
||||
|
||||
|
||||
| otherwise -> do
|
||||
let _letterHead = error "TODO"
|
||||
|
||||
@ -23,4 +23,8 @@ $newline never
|
||||
#{show qualificationUserValidUntil}
|
||||
#{show qualificationUserFirstHeld}
|
||||
|
||||
<p>
|
||||
<h3>
|
||||
EXPIRY
|
||||
TODO: Diese Nachricht muss noch überarbeitet werden.
|
||||
^{ihamletSomeMessage editNotifications}
|
||||
|
||||
@ -36,7 +36,6 @@ $newline never
|
||||
|
||||
<p>
|
||||
<h3>
|
||||
Test
|
||||
content
|
||||
|
||||
RENEWAL
|
||||
TODO: Diese Nachricht muss noch überarbeitet werden.
|
||||
^{ihamletSomeMessage editNotifications}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user