aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Alert.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-31 13:27:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-31 13:27:56 -0400
commitee7c7903672d261f82e22192cbf2b5ce736151a9 (patch)
tree211e0149482b3d0ee3ce5b4b3758f64455a320aa /Assistant/Alert.hs
parent2bc0c67e19dc2b1a55015b9303476fbcaf73e0e0 (diff)
avoid using Blaze directly
New 0.5 changes the api, rather gratuitously, so run away. I can juse use Hamlet here.
Diffstat (limited to 'Assistant/Alert.hs')
-rw-r--r--Assistant/Alert.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Assistant/Alert.hs b/Assistant/Alert.hs
index b73a67b67..c729e4de4 100644
--- a/Assistant/Alert.hs
+++ b/Assistant/Alert.hs
@@ -5,7 +5,7 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE RankNTypes, OverloadedStrings #-}
+{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings #-}
module Assistant.Alert where
@@ -18,7 +18,7 @@ import qualified Data.Text as T
import Data.Text (Text)
import qualified Data.Map as M
import Data.String
-import Text.Blaze
+import Yesod
{- Different classes of alerts are displayed differently. -}
data AlertClass = Success | Message | Activity | Warning | Error
@@ -57,16 +57,16 @@ data Alert = Alert
data AlertIcon = ActivityIcon | SuccessIcon | ErrorIcon | InfoIcon | TheCloud
-htmlIcon :: AlertIcon -> Html
+htmlIcon :: AlertIcon -> GWidget sub master ()
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;"
+htmlIcon TheCloud = [whamlet|&#9730;|]
-bootStrapIcon :: Text -> Html
-bootStrapIcon s = preEscapedText $ T.concat ["<i class=\"icon-", s, "\"></i>"]
+bootStrapIcon :: Text -> GWidget sub master ()
+bootStrapIcon name = [whamlet|<i .icon-#{name}></i>|]
{- When clicked, a button always redirects to a URL
- It may also run an IO action in the background, which is useful