IHP Api Reference
Copyright(c) digitally induced GmbH 2020
Safe HaskellNone

IHP.FlashMessages.ControllerFunctions

Description

 
Synopsis

Documentation

setSuccessMessage :: (?context :: ControllerContext) => Text -> IO () Source #

Sets a flash messages. This is shown to the user when the next view is rendered.

Will be rendered in a bootstrap alert, with the alert-success styling. Take a look at https://getbootstrap.com/docs/4.5/components/alerts/ for how this will look like.

This requires renderFlashMessages to be placed somewhere in the layout or page of the next view. For example:

myLayout view = [hsx|
    {renderFlashMessages}
    <main>{view}</main>
|]

setErrorMessage :: (?context :: ControllerContext) => Text -> IO () Source #

Sets a flash messages. This is shown to the user when the next view is rendered.

Will be rendered in a bootstrap alert, with the alert-danger styling. Take a look at https://getbootstrap.com/docs/4.5/components/alerts/ for how this will look like.

This requires renderFlashMessages to be placed somewhere in the layout or page of the next view. For example:

myLayout view = [hsx|
    {renderFlashMessages}
    <main>{view}</main>
|]

getSuccessMessage :: (?context :: ControllerContext) => IO (Maybe Text) Source #

Returns the flash message currently set

clearSuccessMessage :: (?context :: ControllerContext) => IO () Source #

Removes the current flash message