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

Safe HaskellNone

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

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 -> NodeSource

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

mkTabsSource

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.

tabSource

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.