ihp-1.4.0: Haskell Web Framework
Copyright(c) digitally induced GmbH 2020
Safe HaskellNone
LanguageGHC2021

IHP.Controller.Layout

Description

 
Synopsis

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 defaultLayout

getLayout :: (?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.