Safe HaskellNone

IHP.Controller.Render

Synopsis

Documentation

renderPlain :: (?requestContext :: RequestContext) => ByteString -> IO () Source #

respondHtml :: (?requestContext :: RequestContext) => Html -> IO () Source #

respondSvg :: (?requestContext :: RequestContext) => Html -> IO () Source #

renderHtml :: forall viewContext view controller. (View view viewContext, ?theAction :: controller, ?requestContext :: RequestContext, ?modelContext :: ModelContext, CreateViewContext viewContext, HasField "layout" viewContext Layout, ?controllerContext :: ControllerContext) => view -> IO Html Source #

renderFile :: (?requestContext :: RequestContext, ?modelContext :: ModelContext) => String -> ByteString -> IO () Source #

renderJson :: (?requestContext :: RequestContext) => ToJSON json => json -> IO () Source #

renderJson' :: (?requestContext :: RequestContext) => ResponseHeaders -> ToJSON json => json -> IO () Source #

renderNotFound :: (?requestContext :: RequestContext) => IO () Source #

data PolymorphicRender htmlType jsonType Source #

Constructors

PolymorphicRender 

Fields

class MaybeRender a where Source #

Methods

maybeRenderToMaybe :: a -> Maybe (IO ()) Source #

Instances

Instances details
MaybeRender () Source # 
Instance details

Defined in IHP.Controller.Render

Methods

maybeRenderToMaybe :: () -> Maybe (IO ()) Source #

MaybeRender (IO ()) Source # 
Instance details

Defined in IHP.Controller.Render

Methods

maybeRenderToMaybe :: IO () -> Maybe (IO ()) Source #

renderPolymorphic :: forall viewContext jsonType htmlType. (?requestContext :: RequestContext) => (MaybeRender htmlType, MaybeRender jsonType) => PolymorphicRender htmlType jsonType -> 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 viewContext controller. (View view viewContext, ?theAction :: controller, ?requestContext :: RequestContext, ?modelContext :: ModelContext, CreateViewContext viewContext, HasField "layout" viewContext Layout, ?controllerContext :: ControllerContext) => view -> IO () Source #