Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update to Heist 0.10

  • Loading branch information...
commit 5788e83a259be6b0e9e4c15b9b38880e91b35268 1 parent 7d98732
@mightybyte mightybyte authored
View
9 snap-extras.cabal
@@ -1,5 +1,5 @@
Name: snap-extras
-Version: 0.2.2
+Version: 0.3
Synopsis: A collection of useful helpers and utilities for Snap web applications.
Description: This package contains a collection of helper functions
that come in handy in most practical, real-world
@@ -43,10 +43,11 @@ Library
, digestive-functors >= 0.3
, digestive-functors-snap >= 0.3
, directory-tree >= 0.10 && < 0.11
+ , errors >= 1.3.1 && < 1.4
, filepath
- , heist >= 0.7
+ , heist >= 0.10
, safe
- , snap >= 0.7
+ , snap >= 0.10
, snap-core >= 0.7
, text
, transformers
@@ -54,4 +55,6 @@ Library
, configurator >= 0.2
-- Other-modules:
+
+ ghc-options: -Wall -fwarn-tabs
View
11 src/Snap/Extras.hs
@@ -33,13 +33,16 @@ import Paths_snap_extras
-------------------------------------------------------------------------------
-- | Initialize all the 'Snap.Extras' functionality in your Snap app.
-- Currently, we don't need to keep any state and simply return ().
-initExtras :: HasHeist b => Lens b (Snaplet SessionManager) -> SnapletInit b ()
-initExtras session =
+initExtras :: HasHeist b
+ => Snaplet (Heist b)
+ -> Lens b (Snaplet SessionManager)
+ -> SnapletInit b ()
+initExtras heistSnaplet session =
makeSnaplet
"Snap Extras"
"Collection of utilities for web applications"
(Just getDataDir) $ do
- addTemplatesAt "" . (</> "resources/templates") =<< getSnapletFilePath
+ addTemplatesAt heistSnaplet "" . (</> "resources/templates") =<< getSnapletFilePath
initFlashNotice session
addUtilSplices
- initTabs
+ initTabs
View
5 src/Snap/Extras/FlashNotice.hs
@@ -18,7 +18,8 @@ import qualified Data.Text as T
import Snap.Snaplet
import Snap.Snaplet.Heist
import Snap.Snaplet.Session
-import Text.Templating.Heist
+import Heist
+import Heist.Interpreted
import Text.XmlHtml
-------------------------------------------------------------------------------
@@ -63,7 +64,7 @@ flashError session msg = withSession session $ with session $ setInSession "_err
--
-- Ex: <flash type='warning'/>
-- Ex: <flash type='success'/>
-flashSplice :: Lens b (Snaplet SessionManager) -> SnapletSplice b v
+flashSplice :: Lens b (Snaplet SessionManager) -> SnapletISplice b v
flashSplice session = do
typ <- liftHeist $ liftM (getAttribute "type") getParamNode
let typ' = maybe "warning" id typ
View
2  src/Snap/Extras/FormUtils.hs
@@ -32,7 +32,7 @@ import Safe
import Snap.Core
import Text.Digestive
import Text.Digestive.Snap
-import Text.Templating.Heist
+import Heist
-------------------------------------------------------------------------------
View
9 src/Snap/Extras/SpliceUtils.hs
@@ -25,7 +25,8 @@ import Snap
import Snap.Snaplet.Heist
import System.Directory.Tree
import System.FilePath
-import Text.Templating.Heist
+import Heist
+import Heist.Interpreted
import Text.XmlHtml
-------------------------------------------------------------------------------
@@ -38,7 +39,7 @@ addUtilSplices = addSplices utilSplices
-------------------------------------------------------------------------------
-- | A list of splices offered in this module
-utilSplices :: [(Text, SnapletSplice b v)]
+utilSplices :: [(Text, SnapletISplice b v)]
utilSplices =
[ ("rqparam", liftHeist paramSplice)
]
@@ -78,7 +79,7 @@ runTextAreas :: Monad m => HeistState m -> HeistState m
runTextAreas = bindSplices [ ("textarea", ta)]
where
ta = do
- hs <- getTS
+ hs <- getHS
n@(Element t ats _) <- getParamNode
let nm = nodeText n
case lookupSplice nm hs of
@@ -157,7 +158,7 @@ scriptsSplice dir prefix = do
-- This will look for an entry inside your .cfg file:
--
-- > beta-functions-enabled = true
-ifFlagSplice :: SnapletSplice b v
+ifFlagSplice :: SnapletISplice b v
ifFlagSplice = do
Element t ats es <- liftHeist getParamNode
conf <- liftHandler getSnapletUserConfig
View
6 src/Snap/Extras/Tabs.hs
@@ -28,8 +28,8 @@ import qualified Data.Text.Encoding as T
import Snap.Core
import Snap.Snaplet
import Snap.Snaplet.Heist
-import Text.Templating.Heist
-import Text.Templating.Heist
+import Heist
+import Heist.Interpreted
import Text.XmlHtml
import qualified Text.XmlHtml as X
-------------------------------------------------------------------------------
@@ -54,7 +54,7 @@ tabsSplice = do
let bind = bindSplices [("tab", tabSplice context)]
n <- getParamNode
case n of
- Element t attrs ch -> localTS bind $ runNodeList [X.Element "ul" attrs ch]
+ Element t attrs ch -> localHS bind $ runNodeList [X.Element "ul" attrs ch]
_ -> error "tabs tag has to be an Element"
Please sign in to comment.
Something went wrong with that request. Please try again.