yesod-colonnade-1.3.0.1: Helper functions for using yesod with colonnade

Safe HaskellNone
LanguageHaskell2010

Yesod.Colonnade

Contents

Description

Build HTML tables using yesod and colonnade. To learn how to use this module, first read the documentation for colonnade, and then read the documentation for blaze-colonnade. This library and blaze-colonnade are entirely distinct; neither depends on the other. However, the interfaces they expose are very similar, and the explanations provided counterpart are sufficient to understand this library.

Synopsis

Build

data Cell site Source #

The attributes that will be applied to a td and the HTML content that will go inside it.

Constructors

Cell 

Fields

Instances
IsString (Cell site) Source # 
Instance details

Defined in Yesod.Colonnade

Methods

fromString :: String -> Cell site #

Semigroup (Cell site) Source # 
Instance details

Defined in Yesod.Colonnade

Methods

(<>) :: Cell site -> Cell site -> Cell site #

sconcat :: NonEmpty (Cell site) -> Cell site #

stimes :: Integral b => b -> Cell site -> Cell site #

Monoid (Cell site) Source # 
Instance details

Defined in Yesod.Colonnade

Methods

mempty :: Cell site #

mappend :: Cell site -> Cell site -> Cell site #

mconcat :: [Cell site] -> Cell site #

cell :: WidgetFor site () -> Cell site Source #

Create a Cell from a Widget

stringCell :: String -> Cell site Source #

Create a Cell from a String

textCell :: Text -> Cell site Source #

Create a Cell from a Text

builderCell :: Builder -> Cell site Source #

Create a Cell from a text builder

anchorCell Source #

Arguments

:: (a -> Route site)

Route that will go in href attribute

-> (a -> WidgetFor site ())

Content wrapped by a tag

-> a

Value

-> Cell site 

Create a Cell whose content is hyperlinked by wrapping it in an <a>.

anchorWidget Source #

Arguments

:: (a -> Route site)

Route that will go in href attribute

-> (a -> WidgetFor site ())

Content wrapped by a tag

-> a

Value

-> WidgetFor site () 

Create a widget whose content is hyperlinked by wrapping it in an <a>.

Apply

encodeWidgetTable Source #

Arguments

:: (Foldable f, Headedness h) 
=> [Attribute]

Attributes of <table> element

-> Colonnade h a (WidgetFor site ())

How to encode data as columns

-> f a

Rows of data

-> WidgetFor site () 

Encode an html table.

encodeCellTable Source #

Arguments

:: (Foldable f, Headedness h) 
=> [Attribute]

Attributes of table element

-> Colonnade h a (Cell site)

How to encode data as a row

-> f a

Rows of data

-> WidgetFor site () 

Encode an html table with attributes on the table cells. If you are using the bootstrap css framework, then you may want to call this with the first argument as:

encodeCellTable (HA.class_ "table table-striped") ...

encodeDefinitionTable Source #

Arguments

:: [Attribute]

Attributes of table element.

-> Colonnade Headed a (Cell site)

How to encode data as a row

-> a

The value to display

-> WidgetFor site () 

A two-column table with the header content displayed in the first column and the data displayed in the second column. Note that the generated HTML table does not have a thead.

encodeListItems Source #

Arguments

:: (WidgetFor site () -> WidgetFor site ())

Wrapper for items, often ul

-> (WidgetFor site () -> WidgetFor site () -> WidgetFor site ())

Combines header with data

-> Colonnade Headed a (Cell site)

How to encode data as a row

-> a

The value to display

-> WidgetFor site () 

This determines the attributes that are added to the individual lis by concatenating the header's attributes with the data's attributes.