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

IHP.FlashMessages.ViewFunctions

Description

 
Synopsis

Documentation

renderFlashMessages :: (?context :: ControllerContext) => Html Source #

Displays the flash messages for the current request.

You can add a flash message to the next request by calling setSuccessMessage or setErrorMessage:

action CreateProjectAction = do
    ...
    setSuccessMessage "Your project has been created successfully"
    redirectTo ShowProjectAction { .. }
action CreateTeamAction = do
    unless userOnPaidPlan do
        setErrorMessage "This requires you to be on the paid plan"
        redirectTo NewTeamAction

    ...

For success messages, the text message is wrapped in a class="alert alert-success".../div, which is automatically styled by bootstrap. Errors flash messages are wraped in class="alert alert-danger".../div.