Mirror naming changes in shakespeare
This commit is contained in:
parent
bc5079383d
commit
a4bfb2a0ca
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
CABAL=cabal
|
CABAL=cabal
|
||||||
|
|
||||||
$CABAL update
|
|
||||||
# install testing dependencies
|
# install testing dependencies
|
||||||
$CABAL install HUnit QuickCheck hspec
|
$CABAL install HUnit QuickCheck hspec
|
||||||
|
|
||||||
@ -11,8 +10,6 @@ for package in $PACKAGES
|
|||||||
do
|
do
|
||||||
echo Installing $package
|
echo Installing $package
|
||||||
cd $package
|
cd $package
|
||||||
($CABAL configure --enable-tests ||
|
$CABAL configure --enable-tests && $CABAL build && $CABAL test && ./Setup.lhs install || exit
|
||||||
($CABAL install --only-dependencies && $CABAL configure --enable-tests)
|
|
||||||
) && $CABAL build && $CABAL test && ./Setup.lhs install || exit
|
|
||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
|
|||||||
@ -39,7 +39,7 @@ import qualified Data.Map as Map
|
|||||||
import Language.Haskell.TH.Syntax hiding (lift)
|
import Language.Haskell.TH.Syntax hiding (lift)
|
||||||
|
|
||||||
import qualified Network.Wai as W
|
import qualified Network.Wai as W
|
||||||
import Text.Hamlet (html)
|
import Text.Hamlet (shamlet)
|
||||||
|
|
||||||
import Yesod.Core
|
import Yesod.Core
|
||||||
import Yesod.Persist
|
import Yesod.Persist
|
||||||
@ -119,7 +119,7 @@ setCreds doRedirects creds = do
|
|||||||
Nothing ->
|
Nothing ->
|
||||||
when doRedirects $ do
|
when doRedirects $ do
|
||||||
case authRoute y of
|
case authRoute y of
|
||||||
Nothing -> do rh <- defaultLayout $ addHtml [QQ(html)| <h1>Invalid login |]
|
Nothing -> do rh <- defaultLayout $ addHtml [QQ(shamlet)| <h1>Invalid login |]
|
||||||
sendResponse rh
|
sendResponse rh
|
||||||
Just ar -> do setMessageI Msg.InvalidLogin
|
Just ar -> do setMessageI Msg.InvalidLogin
|
||||||
redirect RedirectTemporary ar
|
redirect RedirectTemporary ar
|
||||||
@ -137,7 +137,7 @@ getCheckR = do
|
|||||||
addHtml $ html' creds) (json' creds)
|
addHtml $ html' creds) (json' creds)
|
||||||
where
|
where
|
||||||
html' creds =
|
html' creds =
|
||||||
[QQ(html)|
|
[QQ(shamlet)|
|
||||||
<h1>Authentication Status
|
<h1>Authentication Status
|
||||||
$maybe _ <- creds
|
$maybe _ <- creds
|
||||||
<p>Logged in.
|
<p>Logged in.
|
||||||
|
|||||||
@ -78,7 +78,7 @@ import Yesod.Handler
|
|||||||
import Yesod.Form
|
import Yesod.Form
|
||||||
import Yesod.Auth
|
import Yesod.Auth
|
||||||
import Yesod.Widget (addHamlet)
|
import Yesod.Widget (addHamlet)
|
||||||
import Text.Hamlet (hamlet, html)
|
import Text.Hamlet (hamlet, shamlet)
|
||||||
|
|
||||||
import Control.Applicative ((<$>), (<*>))
|
import Control.Applicative ((<$>), (<*>))
|
||||||
import Control.Monad (replicateM,liftM)
|
import Control.Monad (replicateM,liftM)
|
||||||
@ -167,7 +167,7 @@ postLoginR uniq = do
|
|||||||
(validateUser <$> (uniq =<< mu) <*> mp)
|
(validateUser <$> (uniq =<< mu) <*> mp)
|
||||||
if isValid
|
if isValid
|
||||||
then setCreds True $ Creds "hashdb" (fromMaybe "" mu) []
|
then setCreds True $ Creds "hashdb" (fromMaybe "" mu) []
|
||||||
else do setMessage [QQ(html)| Invalid username/password |]
|
else do setMessage [QQ(shamlet)| Invalid username/password |]
|
||||||
toMaster <- getRouteToMaster
|
toMaster <- getRouteToMaster
|
||||||
redirect RedirectTemporary $ toMaster LoginR
|
redirect RedirectTemporary $ toMaster LoginR
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ getAuthIdHashDB authR uniq creds = do
|
|||||||
-- user exists
|
-- user exists
|
||||||
Just (uid, _) -> return $ Just uid
|
Just (uid, _) -> return $ Just uid
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
setMessage [QQ(html)| User not found |]
|
setMessage [QQ(shamlet)| User not found |]
|
||||||
redirect RedirectTemporary $ authR LoginR
|
redirect RedirectTemporary $ authR LoginR
|
||||||
|
|
||||||
-- | Prompt for username and password, validate that against a database
|
-- | Prompt for username and password, validate that against a database
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import Yesod.Auth
|
|||||||
import Yesod.Form
|
import Yesod.Form
|
||||||
import Yesod.Handler
|
import Yesod.Handler
|
||||||
import Yesod.Widget
|
import Yesod.Widget
|
||||||
import Text.Hamlet (html)
|
import Text.Hamlet (shamlet)
|
||||||
import Web.Authenticate.OAuth
|
import Web.Authenticate.OAuth
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Data.String
|
import Data.String
|
||||||
@ -69,7 +69,7 @@ authOAuth name ident reqUrl accUrl authUrl key sec = AuthPlugin name dispatch lo
|
|||||||
render <- lift getUrlRender
|
render <- lift getUrlRender
|
||||||
let oaUrl = render $ tm $ oauthUrl name
|
let oaUrl = render $ tm $ oauthUrl name
|
||||||
addHtml
|
addHtml
|
||||||
[QQ(html)| <a href=#{oaUrl}>Login with #{name} |]
|
[QQ(shamlet)| <a href=#{oaUrl}>Login with #{name} |]
|
||||||
|
|
||||||
authTwitter :: YesodAuth m =>
|
authTwitter :: YesodAuth m =>
|
||||||
String -- ^ Consumer Key
|
String -- ^ Consumer Key
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import Yesod.Form
|
|||||||
import Yesod.Handler
|
import Yesod.Handler
|
||||||
import Yesod.Widget
|
import Yesod.Widget
|
||||||
import Yesod.Request
|
import Yesod.Request
|
||||||
import Text.Hamlet (hamlet)
|
|
||||||
import Text.Cassius (cassius)
|
import Text.Cassius (cassius)
|
||||||
import Text.Blaze (toHtml)
|
import Text.Blaze (toHtml)
|
||||||
import Control.Monad.Trans.Class (lift)
|
import Control.Monad.Trans.Class (lift)
|
||||||
@ -34,13 +33,11 @@ authOpenId =
|
|||||||
name = "openid_identifier"
|
name = "openid_identifier"
|
||||||
login tm = do
|
login tm = do
|
||||||
ident <- lift newIdent
|
ident <- lift newIdent
|
||||||
y <- lift getYesod
|
|
||||||
addCassius
|
addCassius
|
||||||
[QQ(cassius)|##{ident}
|
[QQ(cassius)|##{ident}
|
||||||
background: #fff url(http://www.myopenid.com/static/openid-icon-small.gif) no-repeat scroll 0pt 50%;
|
background: #fff url(http://www.myopenid.com/static/openid-icon-small.gif) no-repeat scroll 0pt 50%;
|
||||||
padding-left: 18px;
|
padding-left: 18px;
|
||||||
|]
|
|]
|
||||||
l <- lift languages
|
|
||||||
[QQ(whamlet)|
|
[QQ(whamlet)|
|
||||||
<form method="get" action="@{tm forwardUrl}">
|
<form method="get" action="@{tm forwardUrl}">
|
||||||
<label for="#{ident}">OpenID: #
|
<label for="#{ident}">OpenID: #
|
||||||
|
|||||||
@ -883,14 +883,14 @@ redirectToPost dest = hamletToRepHtml
|
|||||||
-- | Converts the given Hamlet template into 'Content', which can be used in a
|
-- | Converts the given Hamlet template into 'Content', which can be used in a
|
||||||
-- Yesod 'Response'.
|
-- Yesod 'Response'.
|
||||||
hamletToContent :: Monad mo
|
hamletToContent :: Monad mo
|
||||||
=> Hamlet (Route master) -> GGHandler sub master mo Content
|
=> HtmlUrl (Route master) -> GGHandler sub master mo Content
|
||||||
hamletToContent h = do
|
hamletToContent h = do
|
||||||
render <- getUrlRenderParams
|
render <- getUrlRenderParams
|
||||||
return $ toContent $ h render
|
return $ toContent $ h render
|
||||||
|
|
||||||
-- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'.
|
-- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'.
|
||||||
hamletToRepHtml :: Monad mo
|
hamletToRepHtml :: Monad mo
|
||||||
=> Hamlet (Route master) -> GGHandler sub master mo RepHtml
|
=> HtmlUrl (Route master) -> GGHandler sub master mo RepHtml
|
||||||
hamletToRepHtml = liftM RepHtml . hamletToContent
|
hamletToRepHtml = liftM RepHtml . hamletToContent
|
||||||
|
|
||||||
-- | Get the request\'s 'W.Request' value.
|
-- | Get the request\'s 'W.Request' value.
|
||||||
|
|||||||
@ -20,7 +20,7 @@ module Yesod.Internal
|
|||||||
, Title (..)
|
, Title (..)
|
||||||
, Head (..)
|
, Head (..)
|
||||||
, Body (..)
|
, Body (..)
|
||||||
, locationToHamlet
|
, locationToHtmlUrl
|
||||||
, runUniqueList
|
, runUniqueList
|
||||||
, toUnique
|
, toUnique
|
||||||
-- * Names
|
-- * Names
|
||||||
@ -28,9 +28,9 @@ module Yesod.Internal
|
|||||||
, nonceKey
|
, nonceKey
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Text.Hamlet (Hamlet, hamlet, Html)
|
import Text.Hamlet (HtmlUrl, hamlet, Html)
|
||||||
import Text.Cassius (Cassius)
|
import Text.Cassius (CssUrl)
|
||||||
import Text.Julius (Julius)
|
import Text.Julius (JavascriptUrl)
|
||||||
import Data.Monoid (Monoid (..), Last)
|
import Data.Monoid (Monoid (..), Last)
|
||||||
import Data.List (nub)
|
import Data.List (nub)
|
||||||
|
|
||||||
@ -75,10 +75,10 @@ langKey = "_LANG"
|
|||||||
|
|
||||||
data Location url = Local url | Remote Text
|
data Location url = Local url | Remote Text
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
locationToHamlet :: Location url -> Hamlet url
|
locationToHtmlUrl :: Location url -> HtmlUrl url
|
||||||
locationToHamlet (Local url) = [HAMLET|\@{url}
|
locationToHtmlUrl (Local url) = [HAMLET|\@{url}
|
||||||
|]
|
|]
|
||||||
locationToHamlet (Remote s) = [HAMLET|\#{s}
|
locationToHtmlUrl (Remote s) = [HAMLET|\#{s}
|
||||||
|]
|
|]
|
||||||
|
|
||||||
newtype UniqueList x = UniqueList ([x] -> [x])
|
newtype UniqueList x = UniqueList ([x] -> [x])
|
||||||
@ -96,9 +96,9 @@ data Stylesheet url = Stylesheet { styleLocation :: Location url, styleAttribute
|
|||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
newtype Title = Title { unTitle :: Html }
|
newtype Title = Title { unTitle :: Html }
|
||||||
|
|
||||||
newtype Head url = Head (Hamlet url)
|
newtype Head url = Head (HtmlUrl url)
|
||||||
deriving Monoid
|
deriving Monoid
|
||||||
newtype Body url = Body (Hamlet url)
|
newtype Body url = Body (HtmlUrl url)
|
||||||
deriving Monoid
|
deriving Monoid
|
||||||
|
|
||||||
nonceKey :: IsString a => a
|
nonceKey :: IsString a => a
|
||||||
@ -112,8 +112,8 @@ data GWData a = GWData
|
|||||||
!(Last Title)
|
!(Last Title)
|
||||||
!(UniqueList (Script a))
|
!(UniqueList (Script a))
|
||||||
!(UniqueList (Stylesheet a))
|
!(UniqueList (Stylesheet a))
|
||||||
!(Map.Map (Maybe Text) (Cassius a)) -- media type
|
!(Map.Map (Maybe Text) (CssUrl a)) -- media type
|
||||||
!(Maybe (Julius a))
|
!(Maybe (JavascriptUrl a))
|
||||||
!(Head a)
|
!(Head a)
|
||||||
instance Monoid (GWData a) where
|
instance Monoid (GWData a) where
|
||||||
mempty = GWData mempty mempty mempty mempty mempty mempty mempty
|
mempty = GWData mempty mempty mempty mempty mempty mempty mempty
|
||||||
|
|||||||
@ -411,7 +411,7 @@ breadcrumbs = do
|
|||||||
|
|
||||||
applyLayout' :: Yesod master
|
applyLayout' :: Yesod master
|
||||||
=> Html -- ^ title
|
=> Html -- ^ title
|
||||||
-> Hamlet (Route master) -- ^ body
|
-> HtmlUrl (Route master) -- ^ body
|
||||||
-> GHandler sub master ChooseRep
|
-> GHandler sub master ChooseRep
|
||||||
applyLayout' title body = fmap chooseRep $ defaultLayout $ do
|
applyLayout' title body = fmap chooseRep $ defaultLayout $ do
|
||||||
setTitle title
|
setTitle title
|
||||||
@ -496,7 +496,7 @@ widgetToPageContent (GWidget w) = do
|
|||||||
let scripts = runUniqueList scripts'
|
let scripts = runUniqueList scripts'
|
||||||
let stylesheets = runUniqueList stylesheets'
|
let stylesheets = runUniqueList stylesheets'
|
||||||
let jsToHtml (Javascript b) = preEscapedLazyText $ toLazyText b
|
let jsToHtml (Javascript b) = preEscapedLazyText $ toLazyText b
|
||||||
jelper :: Julius url -> Hamlet url
|
jelper :: JavascriptUrl url -> HtmlUrl url
|
||||||
jelper = fmap jsToHtml
|
jelper = fmap jsToHtml
|
||||||
|
|
||||||
render <- getUrlRenderParams
|
render <- getUrlRenderParams
|
||||||
@ -506,7 +506,7 @@ widgetToPageContent (GWidget w) = do
|
|||||||
Just (Left s) -> Just s
|
Just (Left s) -> Just s
|
||||||
Just (Right (u, p)) -> Just $ render u p
|
Just (Right (u, p)) -> Just $ render u p
|
||||||
css <- forM (Map.toList style) $ \(mmedia, content) -> do
|
css <- forM (Map.toList style) $ \(mmedia, content) -> do
|
||||||
let rendered = renderCassius render content
|
let rendered = renderCssUrl render content
|
||||||
x <- addStaticContent "css" "text/css; charset=utf-8"
|
x <- addStaticContent "css" "text/css; charset=utf-8"
|
||||||
$ encodeUtf8 rendered
|
$ encodeUtf8 rendered
|
||||||
return (mmedia,
|
return (mmedia,
|
||||||
@ -518,7 +518,7 @@ widgetToPageContent (GWidget w) = do
|
|||||||
Nothing -> return Nothing
|
Nothing -> return Nothing
|
||||||
Just s -> do
|
Just s -> do
|
||||||
x <- addStaticContent "js" "text/javascript; charset=utf-8"
|
x <- addStaticContent "js" "text/javascript; charset=utf-8"
|
||||||
$ encodeUtf8 $ renderJulius render s
|
$ encodeUtf8 $ renderJavascriptUrl render s
|
||||||
return $ renderLoc x
|
return $ renderLoc x
|
||||||
|
|
||||||
let addAttr x (y, z) = x ! customAttribute (textTag y) (toValue z)
|
let addAttr x (y, z) = x ! customAttribute (textTag y) (toValue z)
|
||||||
|
|||||||
@ -59,7 +59,6 @@ import Control.Monad.Trans.RWS
|
|||||||
import qualified Text.Blaze.Html5 as H
|
import qualified Text.Blaze.Html5 as H
|
||||||
import Text.Hamlet
|
import Text.Hamlet
|
||||||
import Text.Cassius
|
import Text.Cassius
|
||||||
import Text.Lucius (Lucius)
|
|
||||||
import Text.Julius
|
import Text.Julius
|
||||||
import Text.Coffee
|
import Text.Coffee
|
||||||
import Yesod.Handler
|
import Yesod.Handler
|
||||||
@ -112,11 +111,15 @@ addSubWidget sub (GWidget w) = do
|
|||||||
class ToWidget sub master a where
|
class ToWidget sub master a where
|
||||||
toWidget :: a -> GWidget sub master ()
|
toWidget :: a -> GWidget sub master ()
|
||||||
|
|
||||||
instance url ~ Route master => ToWidget sub master (Hamlet url) where
|
-- FIXME At some point in the future, deprecate all the
|
||||||
|
-- addHamlet/Cassius/Lucius/Julius stuff. For the most part, toWidget* will be
|
||||||
|
-- sufficient. For somethings, like addLuciusMedia, create addCssUrlMedia.
|
||||||
|
|
||||||
|
instance url ~ Route master => ToWidget sub master (HtmlUrl url) where
|
||||||
toWidget = addHamlet
|
toWidget = addHamlet
|
||||||
instance url ~ Route master => ToWidget sub master (Cassius url) where
|
instance url ~ Route master => ToWidget sub master (CssUrl url) where
|
||||||
toWidget = addCassius
|
toWidget = addCassius
|
||||||
instance url ~ Route master => ToWidget sub master (Julius url) where
|
instance url ~ Route master => ToWidget sub master (JavascriptUrl url) where
|
||||||
toWidget = addJulius
|
toWidget = addJulius
|
||||||
instance ToWidget sub master (GWidget sub master ()) where
|
instance ToWidget sub master (GWidget sub master ()) where
|
||||||
toWidget = id
|
toWidget = id
|
||||||
@ -128,9 +131,9 @@ instance url ~ Route master => ToWidget sub master (Coffee url) where
|
|||||||
class ToWidgetBody sub master a where
|
class ToWidgetBody sub master a where
|
||||||
toWidgetBody :: a -> GWidget sub master ()
|
toWidgetBody :: a -> GWidget sub master ()
|
||||||
|
|
||||||
instance url ~ Route master => ToWidgetBody sub master (Hamlet url) where
|
instance url ~ Route master => ToWidgetBody sub master (HtmlUrl url) where
|
||||||
toWidgetBody = addHamlet
|
toWidgetBody = addHamlet
|
||||||
instance url ~ Route master => ToWidgetBody sub master (Julius url) where
|
instance url ~ Route master => ToWidgetBody sub master (JavascriptUrl url) where
|
||||||
toWidgetBody = addJulius
|
toWidgetBody = addJulius
|
||||||
instance ToWidgetBody sub master Html where
|
instance ToWidgetBody sub master Html where
|
||||||
toWidgetBody = addHtml
|
toWidgetBody = addHtml
|
||||||
@ -140,11 +143,11 @@ instance url ~ Route master => ToWidgetBody sub master (Coffee url) where
|
|||||||
class ToWidgetHead sub master a where
|
class ToWidgetHead sub master a where
|
||||||
toWidgetHead :: a -> GWidget sub master ()
|
toWidgetHead :: a -> GWidget sub master ()
|
||||||
|
|
||||||
instance url ~ Route master => ToWidgetHead sub master (Hamlet url) where
|
instance url ~ Route master => ToWidgetHead sub master (HtmlUrl url) where
|
||||||
toWidgetHead = addHamletHead
|
toWidgetHead = addHamletHead
|
||||||
instance url ~ Route master => ToWidgetHead sub master (Cassius url) where
|
instance url ~ Route master => ToWidgetHead sub master (CssUrl url) where
|
||||||
toWidgetHead = addCassius
|
toWidgetHead = addCassius
|
||||||
instance url ~ Route master => ToWidgetHead sub master (Julius url) where
|
instance url ~ Route master => ToWidgetHead sub master (JavascriptUrl url) where
|
||||||
toWidgetHead = addJulius
|
toWidgetHead = addJulius
|
||||||
instance ToWidgetHead sub master Html where
|
instance ToWidgetHead sub master Html where
|
||||||
toWidgetHead = addHtmlHead
|
toWidgetHead = addHtmlHead
|
||||||
@ -164,7 +167,7 @@ setTitleI msg = do
|
|||||||
setTitle $ toHtml $ mr msg
|
setTitle $ toHtml $ mr msg
|
||||||
|
|
||||||
-- | Add a 'Hamlet' to the head tag.
|
-- | Add a 'Hamlet' to the head tag.
|
||||||
addHamletHead :: Monad m => Hamlet (Route master) -> GGWidget master m ()
|
addHamletHead :: Monad m => HtmlUrl (Route master) -> GGWidget master m ()
|
||||||
addHamletHead = GWidget . tell . GWData mempty mempty mempty mempty mempty mempty . Head
|
addHamletHead = GWidget . tell . GWData mempty mempty mempty mempty mempty mempty . Head
|
||||||
|
|
||||||
-- | Add a 'Html' to the head tag.
|
-- | Add a 'Html' to the head tag.
|
||||||
@ -172,7 +175,7 @@ addHtmlHead :: Monad m => Html -> GGWidget master m ()
|
|||||||
addHtmlHead = addHamletHead . const
|
addHtmlHead = addHamletHead . const
|
||||||
|
|
||||||
-- | Add a 'Hamlet' to the body tag.
|
-- | Add a 'Hamlet' to the body tag.
|
||||||
addHamlet :: Monad m => Hamlet (Route master) -> GGWidget master m ()
|
addHamlet :: Monad m => HtmlUrl (Route master) -> GGWidget master m ()
|
||||||
addHamlet x = GWidget $ tell $ GWData (Body x) mempty mempty mempty mempty mempty mempty
|
addHamlet x = GWidget $ tell $ GWData (Body x) mempty mempty mempty mempty mempty mempty
|
||||||
|
|
||||||
-- | Add a 'Html' to the body tag.
|
-- | Add a 'Html' to the body tag.
|
||||||
@ -185,19 +188,19 @@ addWidget :: Monad mo => GGWidget m mo () -> GGWidget m mo ()
|
|||||||
addWidget = id
|
addWidget = id
|
||||||
|
|
||||||
-- | Add some raw CSS to the style tag. Applies to all media types.
|
-- | Add some raw CSS to the style tag. Applies to all media types.
|
||||||
addCassius :: Monad m => Cassius (Route master) -> GGWidget master m ()
|
addCassius :: Monad m => CssUrl (Route master) -> GGWidget master m ()
|
||||||
addCassius x = GWidget $ tell $ GWData mempty mempty mempty mempty (Map.singleton Nothing x) mempty mempty
|
addCassius x = GWidget $ tell $ GWData mempty mempty mempty mempty (Map.singleton Nothing x) mempty mempty
|
||||||
|
|
||||||
-- | Identical to 'addCassius'.
|
-- | Identical to 'addCassius'.
|
||||||
addLucius :: Monad m => Lucius (Route master) -> GGWidget master m ()
|
addLucius :: Monad m => CssUrl (Route master) -> GGWidget master m ()
|
||||||
addLucius = addCassius
|
addLucius = addCassius
|
||||||
|
|
||||||
-- | Add some raw CSS to the style tag, for a specific media type.
|
-- | Add some raw CSS to the style tag, for a specific media type.
|
||||||
addCassiusMedia :: Monad m => Text -> Cassius (Route master) -> GGWidget master m ()
|
addCassiusMedia :: Monad m => Text -> CssUrl (Route master) -> GGWidget master m ()
|
||||||
addCassiusMedia m x = GWidget $ tell $ GWData mempty mempty mempty mempty (Map.singleton (Just m) x) mempty mempty
|
addCassiusMedia m x = GWidget $ tell $ GWData mempty mempty mempty mempty (Map.singleton (Just m) x) mempty mempty
|
||||||
|
|
||||||
-- | Identical to 'addCassiusMedia'.
|
-- | Identical to 'addCassiusMedia'.
|
||||||
addLuciusMedia :: Monad m => Text -> Lucius (Route master) -> GGWidget master m ()
|
addLuciusMedia :: Monad m => Text -> CssUrl (Route master) -> GGWidget master m ()
|
||||||
addLuciusMedia = addCassiusMedia
|
addLuciusMedia = addCassiusMedia
|
||||||
|
|
||||||
-- | Link to the specified local stylesheet.
|
-- | Link to the specified local stylesheet.
|
||||||
@ -239,13 +242,13 @@ addScriptRemoteAttrs :: Monad m => Text -> [(Text, Text)] -> GGWidget master m (
|
|||||||
addScriptRemoteAttrs x y = GWidget $ tell $ GWData mempty mempty (toUnique $ Script (Remote x) y) mempty mempty mempty mempty
|
addScriptRemoteAttrs x y = GWidget $ tell $ GWData mempty mempty (toUnique $ Script (Remote x) y) mempty mempty mempty mempty
|
||||||
|
|
||||||
-- | Include raw Javascript in the page's script tag.
|
-- | Include raw Javascript in the page's script tag.
|
||||||
addJulius :: Monad m => Julius (Route master) -> GGWidget master m ()
|
addJulius :: Monad m => JavascriptUrl (Route master) -> GGWidget master m ()
|
||||||
addJulius x = GWidget $ tell $ GWData mempty mempty mempty mempty mempty (Just x) mempty
|
addJulius x = GWidget $ tell $ GWData mempty mempty mempty mempty mempty (Just x) mempty
|
||||||
|
|
||||||
-- | Add a new script tag to the body with the contents of this 'Julius'
|
-- | Add a new script tag to the body with the contents of this 'Julius'
|
||||||
-- template.
|
-- template.
|
||||||
addJuliusBody :: Monad m => Julius (Route master) -> GGWidget master m ()
|
addJuliusBody :: Monad m => JavascriptUrl (Route master) -> GGWidget master m ()
|
||||||
addJuliusBody j = addHamlet $ \r -> H.script $ preEscapedLazyText $ renderJulius r j
|
addJuliusBody j = addHamlet $ \r -> H.script $ preEscapedLazyText $ renderJavascriptUrl r j
|
||||||
|
|
||||||
-- | Add Coffesscript to the page's script tag. Requires the coffeescript
|
-- | Add Coffesscript to the page's script tag. Requires the coffeescript
|
||||||
-- executable to be present at runtime.
|
-- executable to be present at runtime.
|
||||||
@ -265,7 +268,7 @@ addCoffeeBody c = do
|
|||||||
|
|
||||||
-- | Pull out the HTML tag contents and return it. Useful for performing some
|
-- | Pull out the HTML tag contents and return it. Useful for performing some
|
||||||
-- manipulations. It can be easier to use this sometimes than 'wrapWidget'.
|
-- manipulations. It can be easier to use this sometimes than 'wrapWidget'.
|
||||||
extractBody :: Monad mo => GGWidget m mo () -> GGWidget m mo (Hamlet (Route m))
|
extractBody :: Monad mo => GGWidget m mo () -> GGWidget m mo (HtmlUrl (Route m))
|
||||||
extractBody (GWidget w) =
|
extractBody (GWidget w) =
|
||||||
GWidget $ mapRWST (liftM go) w
|
GWidget $ mapRWST (liftM go) w
|
||||||
where
|
where
|
||||||
@ -274,11 +277,11 @@ extractBody (GWidget w) =
|
|||||||
-- | Content for a web page. By providing this datatype, we can easily create
|
-- | Content for a web page. By providing this datatype, we can easily create
|
||||||
-- generic site templates, which would have the type signature:
|
-- generic site templates, which would have the type signature:
|
||||||
--
|
--
|
||||||
-- > PageContent url -> Hamlet url
|
-- > PageContent url -> HtmlUrl url
|
||||||
data PageContent url = PageContent
|
data PageContent url = PageContent
|
||||||
{ pageTitle :: Html
|
{ pageTitle :: Html
|
||||||
, pageHead :: Hamlet url
|
, pageHead :: HtmlUrl url
|
||||||
, pageBody :: Hamlet url
|
, pageBody :: HtmlUrl url
|
||||||
}
|
}
|
||||||
|
|
||||||
whamlet :: QuasiQuoter
|
whamlet :: QuasiQuoter
|
||||||
@ -306,7 +309,7 @@ rules = do
|
|||||||
|
|
||||||
-- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'.
|
-- | Wraps the 'Content' generated by 'hamletToContent' in a 'RepHtml'.
|
||||||
ihamletToRepHtml :: (Monad mo, RenderMessage master message)
|
ihamletToRepHtml :: (Monad mo, RenderMessage master message)
|
||||||
=> NP.IHamlet message (Route master)
|
=> HtmlUrlI18n message (Route master)
|
||||||
-> GGHandler sub master mo RepHtml
|
-> GGHandler sub master mo RepHtml
|
||||||
ihamletToRepHtml ih = do
|
ihamletToRepHtml ih = do
|
||||||
urender <- getUrlRenderParams
|
urender <- getUrlRenderParams
|
||||||
|
|||||||
@ -45,7 +45,7 @@ import Yesod.Core (RenderMessage, liftIOHandler, SomeMessage (..))
|
|||||||
import Yesod.Widget (GWidget, whamlet)
|
import Yesod.Widget (GWidget, whamlet)
|
||||||
import Yesod.Request (reqNonce, reqWaiRequest, reqGetParams, languages)
|
import Yesod.Request (reqNonce, reqWaiRequest, reqGetParams, languages)
|
||||||
import Network.Wai (requestMethod)
|
import Network.Wai (requestMethod)
|
||||||
import Text.Hamlet (html)
|
import Text.Hamlet (shamlet)
|
||||||
import Data.Monoid (mempty)
|
import Data.Monoid (mempty)
|
||||||
import Data.Maybe (listToMaybe, fromMaybe)
|
import Data.Maybe (listToMaybe, fromMaybe)
|
||||||
import Yesod.Message (RenderMessage (..))
|
import Yesod.Message (RenderMessage (..))
|
||||||
@ -54,9 +54,9 @@ import qualified Data.Map as Map
|
|||||||
|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
#define WHAMLET whamlet
|
#define WHAMLET whamlet
|
||||||
#define HTML html
|
#define HTML shamlet
|
||||||
#else
|
#else
|
||||||
#define HTML $html
|
#define HTML $shamlet
|
||||||
#define WHAMLET $whamlet
|
#define WHAMLET $whamlet
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import Data.Time (UTCTime (..), Day, TimeOfDay (..), timeOfDayToTime,
|
|||||||
timeToTimeOfDay)
|
timeToTimeOfDay)
|
||||||
import Data.Char (isSpace)
|
import Data.Char (isSpace)
|
||||||
import Data.Default
|
import Data.Default
|
||||||
import Text.Hamlet (html)
|
import Text.Hamlet (shamlet)
|
||||||
import Text.Julius (julius)
|
import Text.Julius (julius)
|
||||||
import Control.Monad.Trans.Class (lift)
|
import Control.Monad.Trans.Class (lift)
|
||||||
import Data.Text (Text, pack, unpack)
|
import Data.Text (Text, pack, unpack)
|
||||||
@ -30,12 +30,12 @@ import Data.Monoid (mconcat)
|
|||||||
import Yesod.Core (RenderMessage, SomeMessage (..))
|
import Yesod.Core (RenderMessage, SomeMessage (..))
|
||||||
|
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
#define HTML html
|
#define HTML shamlet
|
||||||
#define HAMLET hamlet
|
#define HAMLET hamlet
|
||||||
#define CASSIUS cassius
|
#define CASSIUS cassius
|
||||||
#define JULIUS julius
|
#define JULIUS julius
|
||||||
#else
|
#else
|
||||||
#define HTML $html
|
#define HTML $shamlet
|
||||||
#define HAMLET $hamlet
|
#define HAMLET $hamlet
|
||||||
#define CASSIUS $cassius
|
#define CASSIUS $cassius
|
||||||
#define JULIUS $julius
|
#define JULIUS $julius
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import Yesod.Handler
|
|||||||
import Yesod.Form
|
import Yesod.Form
|
||||||
import Yesod.Widget
|
import Yesod.Widget
|
||||||
import Text.HTML.SanitizeXSS (sanitizeBalance)
|
import Text.HTML.SanitizeXSS (sanitizeBalance)
|
||||||
import Text.Hamlet (Html, html)
|
import Text.Hamlet (Html, shamlet)
|
||||||
import Text.Julius (julius)
|
import Text.Julius (julius)
|
||||||
import Text.Blaze.Renderer.String (renderHtml)
|
import Text.Blaze.Renderer.String (renderHtml)
|
||||||
import Text.Blaze (preEscapedText)
|
import Text.Blaze (preEscapedText)
|
||||||
@ -33,9 +33,9 @@ nicHtmlField = Field
|
|||||||
, fieldView = \theId name val _isReq -> do
|
, fieldView = \theId name val _isReq -> do
|
||||||
addHtml
|
addHtml
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
[html|
|
[shamlet|
|
||||||
#else
|
#else
|
||||||
[$html|
|
[$shamlet|
|
||||||
#endif
|
#endif
|
||||||
<textarea id="#{theId}" name="#{name}" .html>#{showVal val}
|
<textarea id="#{theId}" name="#{name}" .html>#{showVal val}
|
||||||
|]
|
|]
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import Yesod.Content
|
|||||||
import Yesod.Handler
|
import Yesod.Handler
|
||||||
import Yesod.Widget
|
import Yesod.Widget
|
||||||
import Yesod.FeedTypes
|
import Yesod.FeedTypes
|
||||||
import Text.Hamlet (Hamlet, xhamlet, hamlet)
|
import Text.Hamlet (HtmlUrl, xhamlet, hamlet)
|
||||||
import qualified Data.ByteString.Char8 as S8
|
import qualified Data.ByteString.Char8 as S8
|
||||||
import Control.Monad (liftM)
|
import Control.Monad (liftM)
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ instance HasReps RepAtom where
|
|||||||
atomFeed :: Monad mo => Feed (Route master) -> GGHandler sub master mo RepAtom
|
atomFeed :: Monad mo => Feed (Route master) -> GGHandler sub master mo RepAtom
|
||||||
atomFeed = liftM RepAtom . hamletToContent . template
|
atomFeed = liftM RepAtom . hamletToContent . template
|
||||||
|
|
||||||
template :: Feed url -> Hamlet url
|
template :: Feed url -> HtmlUrl url
|
||||||
template arg =
|
template arg =
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
[xhamlet|
|
[xhamlet|
|
||||||
@ -55,7 +55,7 @@ template arg =
|
|||||||
^{entryTemplate entry}
|
^{entryTemplate entry}
|
||||||
|]
|
|]
|
||||||
|
|
||||||
entryTemplate :: FeedEntry url -> Hamlet url
|
entryTemplate :: FeedEntry url -> HtmlUrl url
|
||||||
entryTemplate arg =
|
entryTemplate arg =
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
[xhamlet|
|
[xhamlet|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import Yesod.Handler
|
|||||||
import Yesod.Content
|
import Yesod.Content
|
||||||
import Yesod.Widget
|
import Yesod.Widget
|
||||||
import Yesod.FeedTypes
|
import Yesod.FeedTypes
|
||||||
import Text.Hamlet (Hamlet, xhamlet, hamlet)
|
import Text.Hamlet (HtmlUrl, xhamlet, hamlet)
|
||||||
import qualified Data.ByteString.Char8 as S8
|
import qualified Data.ByteString.Char8 as S8
|
||||||
import Control.Monad (liftM)
|
import Control.Monad (liftM)
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ instance HasReps RepRss where
|
|||||||
rssFeed :: Monad mo => Feed (Route master) -> GGHandler sub master mo RepRss
|
rssFeed :: Monad mo => Feed (Route master) -> GGHandler sub master mo RepRss
|
||||||
rssFeed = liftM RepRss . hamletToContent . template
|
rssFeed = liftM RepRss . hamletToContent . template
|
||||||
|
|
||||||
template :: Feed url -> Hamlet url
|
template :: Feed url -> HtmlUrl url
|
||||||
template arg =
|
template arg =
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
[xhamlet|
|
[xhamlet|
|
||||||
@ -55,7 +55,7 @@ template arg =
|
|||||||
^{entryTemplate entry}
|
^{entryTemplate entry}
|
||||||
|]
|
|]
|
||||||
|
|
||||||
entryTemplate :: FeedEntry url -> Hamlet url
|
entryTemplate :: FeedEntry url -> HtmlUrl url
|
||||||
entryTemplate arg =
|
entryTemplate arg =
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
[xhamlet|
|
[xhamlet|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ module Yesod.Sitemap
|
|||||||
import Yesod.Content (RepXml (..), RepPlain (..), toContent, formatW3)
|
import Yesod.Content (RepXml (..), RepPlain (..), toContent, formatW3)
|
||||||
import Yesod.Handler (Route, GHandler, getUrlRender)
|
import Yesod.Handler (Route, GHandler, getUrlRender)
|
||||||
import Yesod.Handler (hamletToContent)
|
import Yesod.Handler (hamletToContent)
|
||||||
import Text.Hamlet (Hamlet, xhamlet)
|
import Text.Hamlet (HtmlUrl, xhamlet)
|
||||||
import Data.Time (UTCTime)
|
import Data.Time (UTCTime)
|
||||||
import Data.Monoid (mappend)
|
import Data.Monoid (mappend)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ data SitemapUrl url = SitemapUrl
|
|||||||
, priority :: Double
|
, priority :: Double
|
||||||
}
|
}
|
||||||
|
|
||||||
template :: [SitemapUrl url] -> Hamlet url
|
template :: [SitemapUrl url] -> HtmlUrl url
|
||||||
template urls =
|
template urls =
|
||||||
#if __GLASGOW_HASKELL__ >= 700
|
#if __GLASGOW_HASKELL__ >= 700
|
||||||
[xhamlet|
|
[xhamlet|
|
||||||
|
|||||||
@ -23,22 +23,24 @@ module Yesod
|
|||||||
-- ** Hamlet
|
-- ** Hamlet
|
||||||
, hamlet
|
, hamlet
|
||||||
, xhamlet
|
, xhamlet
|
||||||
, Hamlet
|
, HtmlUrl
|
||||||
, Html
|
, Html
|
||||||
, toHtml
|
, toHtml
|
||||||
-- ** Julius
|
-- ** Julius
|
||||||
, julius
|
, julius
|
||||||
, Julius
|
, JavascriptUrl
|
||||||
, renderJulius
|
, renderJavascriptUrl
|
||||||
-- ** Cassius
|
-- ** Cassius/Lucius
|
||||||
, cassius
|
, cassius
|
||||||
, Cassius
|
, lucius
|
||||||
, renderCassius
|
, CssUrl
|
||||||
|
, renderCssUrl
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Yesod.Core
|
import Yesod.Core
|
||||||
import Text.Hamlet
|
import Text.Hamlet
|
||||||
import Text.Cassius
|
import Text.Cassius
|
||||||
|
import Text.Lucius
|
||||||
import Text.Julius
|
import Text.Julius
|
||||||
|
|
||||||
import Yesod.Form
|
import Yesod.Form
|
||||||
|
|||||||
@ -37,7 +37,7 @@ import Text.Jasmine (minifym)
|
|||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Web.ClientSession (getKey)
|
import Web.ClientSession (getKey)
|
||||||
import Text.Blaze.Renderer.Utf8 (renderHtml)
|
import Text.Blaze.Renderer.Utf8 (renderHtml)
|
||||||
import Text.Hamlet (html)
|
import Text.Hamlet (shamlet)
|
||||||
|
|
||||||
-- | The site argument for your application. This can be a good place to
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -183,7 +183,7 @@ instance YesodAuthEmail ~sitearg~ where
|
|||||||
{ partType = "text/html; charset=utf-8"
|
{ partType = "text/html; charset=utf-8"
|
||||||
, partEncoding = None
|
, partEncoding = None
|
||||||
, partFilename = Nothing
|
, partFilename = Nothing
|
||||||
, partContent = renderHtml [~qq~html|
|
, partContent = renderHtml [~qq~shamlet|
|
||||||
<p>Please confirm your email address by clicking on the link below.
|
<p>Please confirm your email address by clicking on the link below.
|
||||||
<p>
|
<p>
|
||||||
<a href=#{verurl}>#{verurl}
|
<a href=#{verurl}>#{verurl}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user