Minor Hamlet changes

This commit is contained in:
Michael Snoyman 2010-04-12 21:56:32 -07:00
parent 343b5a8b80
commit 4a8f674ba1

View File

@ -26,8 +26,8 @@ import Web.Mime
import Web.Encodings (parseHttpAccept) import Web.Encodings (parseHttpAccept)
import Web.Routes (Site (..), encodePathInfo, decodePathInfo) import Web.Routes (Site (..), encodePathInfo, decodePathInfo)
import Data.List (intercalate) import Data.List (intercalate)
import Text.Hamlet hiding (Content, Html) -- FIXME do not export import Text.Hamlet
import qualified Text.Hamlet as Hamlet import Text.Hamlet.Monad (outputHtml)
import qualified Network.Wai as W import qualified Network.Wai as W
import Network.Wai.Middleware.CleanPath import Network.Wai.Middleware.CleanPath
@ -47,12 +47,12 @@ class YesodSite y where
-> Site (Routes y) (YesodApp y) -> Site (Routes y) (YesodApp y)
data PageContent url = PageContent data PageContent url = PageContent
{ pageTitle :: Hamlet url IO Hamlet.Html { pageTitle :: Hamlet url IO HtmlContent
, pageHead :: Hamlet url IO () , pageHead :: Hamlet url IO ()
, pageBody :: Hamlet url IO () , pageBody :: Hamlet url IO ()
} }
simpleContent :: String -> Hamlet.Html -> PageContent url simpleContent :: String -> HtmlContent -> PageContent url
simpleContent title body = PageContent simpleContent title body = PageContent
{ pageTitle = return $ Unencoded $ cs title { pageTitle = return $ Unencoded $ cs title
, pageHead = return () , pageHead = return ()
@ -79,7 +79,7 @@ class YesodSite a => Yesod a where
-> Request -> Request
-> Hamlet (Routes a) IO () -> Hamlet (Routes a) IO ()
applyLayout _ p _ = [$hamlet| applyLayout _ p _ = [$hamlet|
<!DOCTYPE html> !!!
%html %html
%head %head
%title $pageTitle$ %title $pageTitle$