| Copyright | (c) digitally induced GmbH 2020 |
|---|---|
| Safe Haskell | None |
| Language | GHC2021 |
IHP.Controller.Layout
Description
Synopsis
- setLayout :: (?context :: ControllerContext, ?request :: Request) => ((?context :: ControllerContext, ?request :: Request) => Layout) -> IO ()
- getLayout :: (?request :: Request) => IO ViewLayout
- newtype ViewLayout = ViewLayout ((?context :: ControllerContext, ?request :: Request) => Layout)
- viewLayoutVaultKey :: Key (IORef ViewLayout)
- viewLayoutMiddleware :: Middleware
Documentation
setLayout :: (?context :: ControllerContext, ?request :: Request) => ((?context :: ControllerContext, ?request :: Request) => Layout) -> IO () Source #
Set the layout to be used when rendering views.
Example:
instance InitControllerContext WebApplication where
initContext = do
setLayout defaultLayoutgetLayout :: (?request :: Request) => IO ViewLayout Source #
Get the current layout. Returns the identity layout if none was set.
newtype ViewLayout Source #
Wrapper for a layout function that will be applied to views
Constructors
| ViewLayout ((?context :: ControllerContext, ?request :: Request) => Layout) |
viewLayoutVaultKey :: Key (IORef ViewLayout) Source #
Vault key for storing the mutable layout IORef in each request
viewLayoutMiddleware :: Middleware Source #
Middleware that initializes the layout IORef with the identity layout. This must be installed in the middleware stack for setLayout/getLayout to work.