| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Yesod.Colonnade
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
- data Cell site = Cell {
- cellAttrs :: [Attribute]
- cellContents :: !(WidgetFor site ())
- cell :: WidgetFor site () -> Cell site
- stringCell :: String -> Cell site
- textCell :: Text -> Cell site
- builderCell :: Builder -> Cell site
- anchorCell :: (a -> Route site) -> (a -> WidgetFor site ()) -> a -> Cell site
- anchorWidget :: (a -> Route site) -> (a -> WidgetFor site ()) -> a -> WidgetFor site ()
- encodeWidgetTable :: (Foldable f, Headedness h) => [Attribute] -> Colonnade h a (WidgetFor site ()) -> f a -> WidgetFor site ()
- encodeCellTable :: (Foldable f, Headedness h) => [Attribute] -> Colonnade h a (Cell site) -> f a -> WidgetFor site ()
- encodeDefinitionTable :: [Attribute] -> Colonnade Headed a (Cell site) -> a -> WidgetFor site ()
- encodeListItems :: (WidgetFor site () -> WidgetFor site ()) -> (WidgetFor site () -> WidgetFor site () -> WidgetFor site ()) -> Colonnade Headed a (Cell site) -> a -> WidgetFor site ()
Build
The attributes that will be applied to a td and
the HTML content that will go inside it.
Constructors
| Cell | |
Fields
| |
Arguments
| :: (a -> Route site) | Route that will go in |
| -> (a -> WidgetFor site ()) | Content wrapped by |
| -> a | Value |
| -> Cell site |
Create a Cell whose content is hyperlinked by wrapping
it in an <a>.
Arguments
| :: (a -> Route site) | Route that will go in |
| -> (a -> WidgetFor site ()) | Content wrapped by |
| -> a | Value |
| -> WidgetFor site () |
Create a widget whose content is hyperlinked by wrapping
it in an <a>.
Apply
Arguments
| :: (Foldable f, Headedness h) | |
| => [Attribute] | Attributes of |
| -> Colonnade h a (WidgetFor site ()) | How to encode data as columns |
| -> f a | Rows of data |
| -> WidgetFor site () |
Encode an html table.
Arguments
| :: (Foldable f, Headedness h) | |
| => [Attribute] | Attributes of |
| -> 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 |
| -> 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.
Arguments
| :: (WidgetFor site () -> WidgetFor site ()) | Wrapper for items, often |
| -> (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.