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.
This commit is contained in:
Joey Hess 2012-10-27 11:24:35 -04:00
parent 6633a5158d
commit b72d04988f
2 changed files with 15 additions and 9 deletions

View file

@ -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

View file

@ -5,15 +5,15 @@
$if block
<h4 .alert-heading>
$maybe i <- alertIcon alert
<i .icon-#{bootstrapIcon i}></i> #
#{htmlIcon i} #
#{h}
$else
$maybe i <- alertIcon alert
<i .icon-#{bootstrapIcon i}></i> #
#{htmlIcon i} #
<strong>#{h}</strong> #
$nothing
$maybe i <- alertIcon alert
<i .icon-#{bootstrapIcon i}></i> #
#{htmlIcon i} #
#{renderAlertMessage alert}
$maybe button <- alertButton alert
<br>