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

Safe HaskellNone
LanguageHaskell2010

Snap.Extras.Tabs

Contents

Description

Purpose of this module is to provide a simple, functional way to define tabs in Snap applications.

Synopsis

Define Tabs in DOM via Heist

initTabs :: HasHeist b => Snaplet (Heist b) -> Initializer b v () Source

tabsSplice :: MonadSnap m => Splice m Source

tabsCSplice :: MonadSnap m => Splice m Source

Compiled splice for tabs.

Define Tabs in Haskell

data TabActiveMode Source

How do we decide "active" for tab state?

Constructors

TAMExactMatch

Current url has to match exactly

TAMPrefixMatch

Only the prefix needs to match current url

TAMInfixMatch

A sub-set of the current url has to match

TAMDontMatch 

type Tab = Text -> Node Source

A tab is a Node generator upon receiving a current URL context.

mkTabs Source

Arguments

:: MonadSnap m 
=> Text

A class to be given to the parent ul tag

-> [Tab]

List of tabs in order

-> Splice m 

Make tabs from tab definitions. Use the tab combinator to define individual options.

tab Source

Arguments

:: Text

Target URL for tab

-> Text

A text/label for tab

-> [(Text, Text)]

A list of attributes as key=val

-> TabActiveMode

A TabActiveMode for this tab

-> Tab 

Tab item constructor to be used with mkTabs. Just supply the given arguments here and it will create a Tab ready to be used in mkTabs.

If the tab is currently active, the li tag will get a class of 'active'.

Make sure to provide a trailing / when indicating URLs as snap context paths contain it and active tab checks will be confused without it.