This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap".
The branch, master has been updated
via 25639d50a6030d4b4cf1f3ee9dfd739c54d426b4 (commit)
via 0324a603a851df046e0de22711d19d838c2868b3 (commit)
from faf165c266aafed48c605eb00b22c499ab1063cc (commit)
Summary of changes:
src/Snap/Extension/Heist/Impl.hs | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 25639d50a6030d4b4cf1f3ee9dfd739c54d426b4
Merge: 0324a60 faf165c
Author: Ozgun Ataman <[email protected]>
Date: Thu Dec 9 10:39:34 2010 -0500
Merge branch 'master' of git.snapframework.com:snap
commit 0324a603a851df046e0de22711d19d838c2868b3
Author: Ozgun Ataman <[email protected]>
Date: Thu Dec 9 10:39:28 2010 -0500
* reinstate registerSplices (previously persistSplices)
diff --git a/src/Snap/Extension/Heist/Impl.hs b/src/Snap/Extension/Heist/Impl.hs
index 350c138..7ef7115 100644
--- a/src/Snap/Extension/Heist/Impl.hs
+++ b/src/Snap/Extension/Heist/Impl.hs
@@ -51,6 +51,7 @@ module Snap.Extension.Heist.Impl
, MonadHeist(..)
, HasHeistState(..)
, heistInitializer
+ , registerSplices
) where
import Control.Applicative
@@ -161,3 +162,22 @@ instance HasHeistState m s => MonadHeist m (ReaderT s m)
where
heistLocal f = local $ modifyHeistState $ \s ->
s { _modifier = f . _modifier s }
+
+
+------------------------------------------------------------------------------
+-- | Take your application's state and register these splices in it so
+-- that you don't have to re-list them in every handler. Should be called from
+-- inside your application's 'Initializer'.
+--
+-- Typical use cases are dynamically generated components that are present in
+-- many of your views.
+registerSplices
+ :: (MonadSnap m, MonadIO n)
+ => HeistState m
+ -- ^ Heist state that you are going to embed in your application's state.
+ -> [(B.ByteString, Splice m)]
+ -- ^ Your splices.
+ -> n ()
+registerSplices s sps = liftIO $ do
+ let mv = _tsMVar s
+ modifyMVar_ mv $ (return . bindSplices sps)
-----------------------------------------------------------------------
hooks/post-receive
--
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap