diff options
-rw-r--r-- | Assistant/Alert.hs | 20 | ||||
-rw-r--r-- | templates/sidebar/alert.hamlet | 12 |
2 files changed, 20 insertions, 12 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 diff --git a/templates/sidebar/alert.hamlet b/templates/sidebar/alert.hamlet index ee15f1621..c5138d79a 100644 --- a/templates/sidebar/alert.hamlet +++ b/templates/sidebar/alert.hamlet @@ -4,16 +4,16 @@ $maybe h <- renderAlertHeader alert $if block <h4 .alert-heading> - $maybe name <- alertIcon alert - <i .icon-#{name}></i> # + $maybe i <- alertIcon alert + <i .icon-#{bootstrapIcon i}></i> # #{h} $else - $maybe name <- alertIcon alert - <i .icon-#{name}></i> # + $maybe i <- alertIcon alert + <i .icon-#{bootstrapIcon i}></i> # <strong>#{h}</strong> # $nothing - $maybe name <- alertIcon alert - <i .icon-#{name}></i> # + $maybe i <- alertIcon alert + <i .icon-#{bootstrapIcon i}></i> # #{renderAlertMessage alert} $maybe button <- alertButton alert <br> |