snap-extras-0.7: A collection of useful helpers and utilities for Snap web applications.

Safe HaskellNone




paramSplice :: MonadSnap m => Splice mSource

Gets the value of a request parameter. Example use:


utilSplices :: Splices (SnapletISplice b)Source

A list of splices offered in this module



:: Monad m 
=> Text

A name for the select element

-> Text

An id for the select element

-> [(Text, Text)]

value, shown text pairs

-> Maybe Text

Default value

-> Splice m 

Splice helper for when you're rendering a select element

runTextAreas :: Monad m => HeistState m -> HeistState mSource

Assume text area contains the name of a splice as Text.

This is helpful when you pass a default value to digestive-functors by putting the name of a splice as the value of a textarea tag.

 heistLocal runTextAreas $ render "joo/index"



:: MonadIO m 
=> FilePath

Path to the directory on disk holding the javascript files.

-> String

A prefix to add to the src attribute of each script tag.

-> m [Node] 

Searches a directory on disk and all its subdirectories for all files with names that don't begin with an underscore and end with a .js extension. It then returns script tags for each of these files.

You can use this function to create a splice:

 ("staticscripts", scriptsSplice "static/js" "/")

Then when you use the <staticscripts/> tag in your templates, it will automatically include all the javascript code in the static/js directory.

ifFlagSplice :: SnapletISplice bSource

Check to see if the boolean flag named by the ref attribute is present and set to true in snaplet user config file. If so, run what's inside this splice, if not, simply omit that part.


 <flag ref="beta-functions-enabled">

This will look for an entry inside your .cfg file:

 beta-functions-enabled = true