Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

small edits to README

  • Loading branch information...
commit dc1cb4f80aaa3c959b138e586532e8cf8e57f05b 1 parent 14f1ca9
@davidsd authored
Showing with 24 additions and 27 deletions.
  1. +24 −27 README.md
View
51 README.md
@@ -67,42 +67,39 @@ Setup
-----
* Add the snaplet to your application's state, and define a `HasAjax` instance.
+```haskell
+data App = App
+ { _heist :: Snaplet (Heist App)
+ , _ajax :: Snaplet (Ajax App)
+ }
- ```haskell
- data App = App
- { _heist :: Snaplet (Heist App)
- , _ajax :: Snaplet (Ajax App)
- }
-
- makeLens ''App
+makeLens ''App
- instance HasHeist App where
- heistLens = subSnaplet heist
+instance HasHeist App where
+ heistLens = subSnaplet heist
- instance HasAjax App where
- ajaxLens = ajax
+instance HasAjax App where
+ ajaxLens = ajax
- type AppHandler = Handler App App
- ```
+type AppHandler = Handler App App
+```
* Call nestSnaplet appropriately in your application's initializer.
-
- ```haskell
- app = makeSnaplet "app" "An snaplet example application." Nothing $ do
- h <- nestSnaplet "" heist $ heistInit "templates"
- a <- nestSnaplet "ajax" ajax $ ajaxInit defaultAjaxState
- addRoutes [("/", serveDirectory "static")]
- addSplices [("addIntsForm", liftHeist addIntsSplice)]
- return $ App h a
- ```
+```haskell
+app = makeSnaplet "app" "An snaplet example application." Nothing $ do
+ h <- nestSnaplet "" heist $ heistInit "templates"
+ a <- nestSnaplet "ajax" ajax $ ajaxInit defaultAjaxState
+ addRoutes [("/", serveDirectory "static")]
+ addSplices [("addIntsForm", liftHeist addIntsSplice)]
+ return $ App h a
+```
* Add jquery and liftAjax.js to your site's header (and place the
files where they'll be served)
-
- ```html
- <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
- <script type="text/javascript" src="liftAjax.js"></script>
- ```
+```html
+<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
+<script type="text/javascript" src="liftAjax.js"></script>
+```
* Add the `<ajaxFooter />` just before your site's body tag.
Please sign in to comment.
Something went wrong with that request. Please try again.