show alerts in the sidebar

This has a bug -- it seems long polling can only wait on one page at a
time. Need to re-unify the notifiers.
This commit is contained in:
Joey Hess 2012-07-29 11:31:06 -04:00
parent 5271d699d2
commit c2f3e66d8c
4 changed files with 59 additions and 27 deletions

View file

@ -14,12 +14,23 @@ import Yesod
type Widget = forall sub master. GWidget sub master ()
{- Different classes of alerts are displayed differently. -}
data AlertClass = Activity | Warning | Error | Message
data AlertClass = Activity | Warning | Error | Success | Message
deriving (Eq)
{- An alert can be a simple message, or a Yesod Widget -}
{- An alert can be a simple message, or an arbitrary Yesod Widget -}
data AlertMessage = StringAlert String | WidgetAlert Widget
data Alert = Alert
{ alertClass :: AlertClass
, alertHeader :: Maybe String
, alertMessage :: AlertMessage
, alertBlockDisplay :: Bool
}
activityAlert :: Maybe String -> String -> Alert
activityAlert header message = Alert
{ alertClass = Activity
, alertHeader = header
, alertMessage = StringAlert message
, alertBlockDisplay = False
}