{-# LANGUAGE NoImplicitPrelude, TemplateHaskell, QuasiQuotes #-} module Handler.Utils.Templates where import Import.NoFoundation lipsum :: WidgetT site IO () lipsum = $(widgetFile "widgets/lipsum") modalStatic :: Html -> WidgetT site IO () modalStatic modalContent = do uniqueId <- newIdent let modalTrigger = cons '#' uniqueId -- SJ: I am confused why this is needed here? modalId :: Int32 modalId = 13 $(widgetFile "widgets/modalStatic") [whamlet|
?|] -- SJ: confused why ## is needed here either? modal :: Text -> Maybe [Char] -> WidgetT site IO () modal modalTrigger (Just modalContent) = do -- WARNING: ModalContent should not have length 11. SJ: This is possibly bad. See Template! let modalId :: Int32 modalId = 13 $(widgetFile "widgets/modal") modal modalTrigger Nothing = do let modalId :: Int32 modalId = 13 modalContent :: [Char] modalContent = "placeholder" $(widgetFile "widgets/modal")