summaryrefslogtreecommitdiff
path: root/Assistant/Alert.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-27 11:24:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-27 11:24:35 -0400
commit8a992bcef5d4426b835a3afaca9dbe1c1085a745 (patch)
tree4fa54308514bb3b9e6b13c0837df066454a194e8 /Assistant/Alert.hs
parent2b33c29d2cebc6c2319922c70c6ba19d4c5654dd (diff)
add an icon for The Cloud
I am befuddled that Twitter Bootstrap has no built-in Icon for The Cloud, and also that Chromium's depiction of CLOUD (U+2601) has an uncanny resemblance to PILE OF POO (U+1F4A9) when rendered small, and looks like a looming Frankenstorm when rendered large, and not a sweet, sunny, nothing can go wrong The Cloud. <http://www.fileformat.info/info/unicode/char/2601/browsertest.htm>; So, I must resort to irony in my choice of icons.
Diffstat (limited to 'Assistant/Alert.hs')
-rw-r--r--Assistant/Alert.hs18
1 files changed, 12 insertions, 6 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index f11ad8f58..d873d21c7 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -18,6 +18,7 @@ import qualified Data.Text as T
import Data.Text (Text)
import qualified Data.Map as M
import Data.String
+import Text.Blaze
{- Different classes of alerts are displayed differently. -}
data AlertClass = Success | Message | Activity | Warning | Error
@@ -53,13 +54,18 @@ data Alert = Alert
, alertButton :: Maybe AlertButton
}
-data AlertIcon = ActivityIcon | SuccessIcon | ErrorIcon | InfoIcon
+data AlertIcon = ActivityIcon | SuccessIcon | ErrorIcon | InfoIcon | TheCloud
-bootstrapIcon :: AlertIcon -> String
-bootstrapIcon ActivityIcon = "refresh"
-bootstrapIcon InfoIcon = "info-sign"
-bootstrapIcon SuccessIcon = "ok"
-bootstrapIcon ErrorIcon = "exclamation-sign"
+htmlIcon :: AlertIcon -> Html
+htmlIcon ActivityIcon = bootStrapIcon "refresh"
+htmlIcon InfoIcon = bootStrapIcon "info-sign"
+htmlIcon SuccessIcon = bootStrapIcon "ok"
+htmlIcon ErrorIcon = bootStrapIcon "exclamation-sign"
+-- utf-8 umbrella (utf-8 cloud looks too stormy)
+htmlIcon TheCloud = preEscapedText "&#9730;"
+
+bootStrapIcon :: Text -> Html
+bootStrapIcon s = preEscapedText $ T.concat ["<i class=\"icon-", s, "\"></i>"]
{- When clicked, a button always redirects to a URL
- It may also run an IO action in the background, which is useful