Safe Haskell | None |
---|---|
Language | Haskell2010 |
Setup this package by modifying your definition of *defaultLayout* in *Foundation.hs*
... defaultLayout widget = do ... alerts <- getAlerts ...
Then Include a renderer in *default-layout.hamlet*
... #{renderAlertsBootstrap3 alerts} ... ^{widget} ...
Set alerts from your handlers
getHomeR :: Handler Html getHomeR = do ... setAlert (Alert Error "oops") setSuccessAlert "Yay!" ... defautlLayout $ do $(widgetFile "homepage")
Synopsis
- setAlert :: MonadHandler m => Alert -> m ()
- setAlertI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => AlertStatus -> msg -> m ()
- setDefaultAlert :: MonadHandler m => Text -> m ()
- setInfoAlert :: MonadHandler m => Text -> m ()
- setSuccessAlert :: MonadHandler m => Text -> m ()
- setWarningAlert :: MonadHandler m => Text -> m ()
- setErrorAlert :: MonadHandler m => Text -> m ()
- getAlerts :: MonadHandler m => m [Alert]
- data Alert = Alert {}
- data AlertStatus
Setting alerts
setAlertI :: (MonadHandler m, RenderMessage (HandlerSite m) msg) => AlertStatus -> msg -> m () Source #
Set an Alert
allowing i18n
Shortcuts
setDefaultAlert :: MonadHandler m => Text -> m () Source #
setInfoAlert :: MonadHandler m => Text -> m () Source #
setSuccessAlert :: MonadHandler m => Text -> m () Source #
setWarningAlert :: MonadHandler m => Text -> m () Source #
setErrorAlert :: MonadHandler m => Text -> m () Source #
Getting alerts
data AlertStatus #
Instances
Bounded AlertStatus | |
Defined in Web.Alert minBound :: AlertStatus # maxBound :: AlertStatus # | |
Eq AlertStatus | |
Defined in Web.Alert (==) :: AlertStatus -> AlertStatus -> Bool # (/=) :: AlertStatus -> AlertStatus -> Bool # | |
Read AlertStatus | |
Defined in Web.Alert readsPrec :: Int -> ReadS AlertStatus # readList :: ReadS [AlertStatus] # readPrec :: ReadPrec AlertStatus # readListPrec :: ReadPrec [AlertStatus] # | |
Show AlertStatus | |
Defined in Web.Alert showsPrec :: Int -> AlertStatus -> ShowS # show :: AlertStatus -> String # showList :: [AlertStatus] -> ShowS # |