Safe Haskell | None |
---|
IHP.Controller.Render
Synopsis
- renderPlain :: (?context :: ControllerContext) => LByteString -> IO ()
- respondHtml :: (?context :: ControllerContext) => Html -> IO ()
- respondSvg :: (?context :: ControllerContext) => Html -> IO ()
- renderHtml :: forall viewContext view controller. (View view, ?theAction :: controller, ?context :: ControllerContext, ?modelContext :: ModelContext) => view -> IO Html
- renderFile :: (?context :: ControllerContext, ?modelContext :: ModelContext) => String -> ByteString -> IO ()
- renderJson :: (?context :: ControllerContext) => ToJSON json => json -> IO ()
- renderJson' :: (?context :: ControllerContext) => ResponseHeaders -> ToJSON json => json -> IO ()
- renderNotFound :: (?context :: ControllerContext) => IO ()
- data PolymorphicRender = PolymorphicRender {}
- renderPolymorphic :: forall viewContext jsonType htmlType. (?context :: ControllerContext) => PolymorphicRender -> IO ()
- polymorphicRender :: PolymorphicRender
- render :: forall view controller. (View view, ?theAction :: controller, ?context :: ControllerContext, ?modelContext :: ModelContext) => view -> IO ()
Documentation
renderPlain :: (?context :: ControllerContext) => LByteString -> IO () Source #
respondHtml :: (?context :: ControllerContext) => Html -> IO () Source #
respondSvg :: (?context :: ControllerContext) => Html -> IO () Source #
renderHtml :: forall viewContext view controller. (View view, ?theAction :: controller, ?context :: ControllerContext, ?modelContext :: ModelContext) => view -> IO Html Source #
renderFile :: (?context :: ControllerContext, ?modelContext :: ModelContext) => String -> ByteString -> IO () Source #
renderJson :: (?context :: ControllerContext) => ToJSON json => json -> IO () Source #
renderJson' :: (?context :: ControllerContext) => ResponseHeaders -> ToJSON json => json -> IO () Source #
renderNotFound :: (?context :: ControllerContext) => IO () Source #
data PolymorphicRender Source #
renderPolymorphic :: forall viewContext jsonType htmlType. (?context :: ControllerContext) => PolymorphicRender -> IO () Source #
Can be used to render different responses for html, json, etc. requests based on Accept
header
Example:
`
show :: Action
show = do
renderPolymorphic polymorphicRender {
html = renderHtml [hsx|divHello World/div|]
json = renderJson True
}
`
This will render `Hello World` for normal browser requests and true
when requested via an ajax request
render :: forall view controller. (View view, ?theAction :: controller, ?context :: ControllerContext, ?modelContext :: ModelContext) => view -> IO () Source #