summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-09 15:09:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-09 15:09:22 -0400
commit690b424cad86f6ebd4e5f9755f0f2751aafb4cdd (patch)
treef36fb15b3c2ecfa69ce39aac219939c3a237f318 /Assistant
parentf75ac910c4876e6cdbb2eb4f48a9dd5ea7c8ec54 (diff)
unify bootstrap icon names in a data type
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Alert.hs20
1 files changed, 14 insertions, 6 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index f67de2402..f9cf4b3a8 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -47,12 +47,20 @@ data Alert = Alert
, alertBlockDisplay :: Bool
, alertClosable :: Bool
, alertPriority :: AlertPriority
- , alertIcon :: Maybe String
+ , alertIcon :: Maybe AlertIcon
, alertCombiner :: Maybe AlertCombiner
, alertName :: Maybe AlertName
, alertButton :: Maybe AlertButton
}
+data AlertIcon = ActivityIcon | SuccessIcon | ErrorIcon | InfoIcon
+
+bootstrapIcon :: AlertIcon -> String
+bootstrapIcon ActivityIcon = "refresh"
+bootstrapIcon InfoIcon = "info-sign"
+bootstrapIcon SuccessIcon = "ok"
+bootstrapIcon ErrorIcon = "exclamation-sign"
+
{- When clicked, a button always redirects to a URL
- It may also run an IO action in the background, which is useful
- to make the button close or otherwise change the alert. -}
@@ -140,7 +148,7 @@ makeAlertFiller success alert
{ alertClass = if c == Activity then c' else c
, alertPriority = Filler
, alertClosable = True
- , alertIcon = Just $ if success then "ok" else "exclamation-sign"
+ , alertIcon = Just $ if success then SuccessIcon else ErrorIcon
}
where
c = alertClass alert
@@ -190,7 +198,7 @@ baseActivityAlert = Alert
, alertBlockDisplay = False
, alertClosable = False
, alertPriority = Medium
- , alertIcon = Just "refresh"
+ , alertIcon = Just ActivityIcon
, alertCombiner = Nothing
, alertName = Nothing
, alertButton = Nothing
@@ -205,7 +213,7 @@ warningAlert name msg = Alert
, alertBlockDisplay = True
, alertClosable = True
, alertPriority = High
- , alertIcon = Just "exclamation-sign"
+ , alertIcon = Just ErrorIcon
, alertCombiner = Just $ dataCombiner (++)
, alertName = Just $ WarningAlert name
, alertButton = Nothing
@@ -267,7 +275,7 @@ sanityCheckFixAlert msg = Alert
, alertBlockDisplay = True
, alertPriority = High
, alertClosable = True
- , alertIcon = Just "exclamation-sign"
+ , alertIcon = Just ErrorIcon
, alertName = Just SanityCheckFixAlert
, alertCombiner = Just $ dataCombiner (++)
, alertButton = Nothing
@@ -286,7 +294,7 @@ pairRequestAlert repo msg button = Alert
, alertBlockDisplay = True
, alertPriority = High
, alertClosable = True
- , alertIcon = Just "info-sign"
+ , alertIcon = Just InfoIcon
, alertName = Just $ PairRequestAlert repo
, alertCombiner = Just $ dataCombiner $ const id
, alertButton = Just button