summaryrefslogtreecommitdiff
path: root/Assistant/Alert.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-29 11:31:06 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-29 11:31:06 -0400
commitc2f3e66d8c65e46046f83221996b3a180bd49657 (patch)
treeda30e48c507d5503ab48a6f9ed4d2910dad7abf6 /Assistant/Alert.hs
parent5271d699d22f9addb35f2374a2a70da59897bb1d (diff)
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.
Diffstat (limited to 'Assistant/Alert.hs')
-rw-r--r--Assistant/Alert.hs15
1 files changed, 13 insertions, 2 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index c8bfa48fd..f4220eea9 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -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
}