Works with subsite-with-static
This commit is contained in:
parent
97b07380e5
commit
b0634b0d45
@ -4,6 +4,7 @@
|
|||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
|
{-# LANGUAGE RankNTypes #-}
|
||||||
module Yesod.Core.Internal.TH where
|
module Yesod.Core.Internal.TH where
|
||||||
|
|
||||||
import Prelude hiding (exp)
|
import Prelude hiding (exp)
|
||||||
@ -22,6 +23,7 @@ import Text.ParserCombinators.Parsec.Char (alphaNum, spaces, string, char)
|
|||||||
|
|
||||||
import Yesod.Routes.TH
|
import Yesod.Routes.TH
|
||||||
import Yesod.Routes.Parse
|
import Yesod.Routes.Parse
|
||||||
|
import Yesod.Core.Content (ToTypedContent (..))
|
||||||
import Yesod.Core.Types
|
import Yesod.Core.Types
|
||||||
import Yesod.Core.Class.Dispatch
|
import Yesod.Core.Class.Dispatch
|
||||||
import Yesod.Core.Internal.Run
|
import Yesod.Core.Internal.Run
|
||||||
@ -217,14 +219,7 @@ mkYesodSubDispatch res = do
|
|||||||
(mkMDS
|
(mkMDS
|
||||||
return
|
return
|
||||||
[|subHelper|]
|
[|subHelper|]
|
||||||
[|\_ getSub toParent env -> yesodSubDispatch
|
[|subTopDispatch|])
|
||||||
YesodSubRunnerEnv
|
|
||||||
{ ysreParentRunner = ysreParentRunner env
|
|
||||||
, ysreGetSub = getSub . ysreGetSub env
|
|
||||||
, ysreToParentRoute = ysreToParentRoute env . toParent
|
|
||||||
, ysreParentEnv = ysreParentEnv env
|
|
||||||
}
|
|
||||||
|])
|
|
||||||
res
|
res
|
||||||
inner <- newName "inner"
|
inner <- newName "inner"
|
||||||
let innerFun = FunD inner [clause']
|
let innerFun = FunD inner [clause']
|
||||||
@ -236,6 +231,26 @@ mkYesodSubDispatch res = do
|
|||||||
[innerFun]
|
[innerFun]
|
||||||
]
|
]
|
||||||
return $ LetE [fun] (VarE helper)
|
return $ LetE [fun] (VarE helper)
|
||||||
|
|
||||||
|
subTopDispatch ::
|
||||||
|
(YesodSubDispatch sub master) =>
|
||||||
|
(forall content. ToTypedContent content =>
|
||||||
|
SubHandlerFor child master content ->
|
||||||
|
YesodSubRunnerEnv child master ->
|
||||||
|
Maybe (Route child) ->
|
||||||
|
W.Application
|
||||||
|
) ->
|
||||||
|
(mid -> sub) ->
|
||||||
|
(Route sub -> Route mid) ->
|
||||||
|
YesodSubRunnerEnv mid master ->
|
||||||
|
W.Application
|
||||||
|
subTopDispatch _ getSub toParent env = yesodSubDispatch
|
||||||
|
(YesodSubRunnerEnv
|
||||||
|
{ ysreParentRunner = ysreParentRunner env
|
||||||
|
, ysreGetSub = getSub . ysreGetSub env
|
||||||
|
, ysreToParentRoute = ysreToParentRoute env . toParent
|
||||||
|
, ysreParentEnv = ysreParentEnv env
|
||||||
|
})
|
||||||
|
|
||||||
instanceD :: Cxt -> Type -> [Dec] -> Dec
|
instanceD :: Cxt -> Type -> [Dec] -> Dec
|
||||||
instanceD = InstanceD Nothing
|
instanceD = InstanceD Nothing
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.6.24.2
|
version: 1.6.24.3
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user