Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- data Cell site = Cell {
- cellAttrs :: !Attribute
- cellContents :: !(WidgetT site IO ())
- cell :: WidgetT site IO () -> Cell site
- stringCell :: String -> Cell site
- textCell :: Text -> Cell site
- builderCell :: Builder -> Cell site
- anchorCell :: (a -> Route site) -> (a -> WidgetT site IO ()) -> a -> Cell site
- encodeHeadedWidgetTable :: Foldable f => Attribute -> Colonnade Headed (WidgetT site IO ()) a -> f a -> WidgetT site IO ()
- encodeHeadlessWidgetTable :: Foldable f => Attribute -> Colonnade Headless (WidgetT site IO ()) a -> f a -> WidgetT site IO ()
- encodeHeadedCellTable :: Foldable f => Attribute -> Colonnade Headed (Cell site) a -> f a -> WidgetT site IO ()
- encodeHeadlessCellTable :: Foldable f => Attribute -> Colonnade Headless (Cell site) a -> f a -> WidgetT site IO ()
- encodeDefinitionTable :: Attribute -> Colonnade Headed (Cell site) a -> a -> WidgetT site IO ()
- encodeListItems :: (WidgetT site IO () -> WidgetT site IO ()) -> (WidgetT site IO () -> WidgetT site IO () -> WidgetT site IO ()) -> Colonnade Headed (Cell site) a -> a -> WidgetT site IO ()
Build
The attributes that will be applied to a td
and
the HTML content that will go inside it.
:: (a -> Route site) | Route that will go in |
-> (a -> WidgetT site IO ()) | Content wrapped by |
-> a | Value |
-> Cell site |
Creata a Cell
whose content is hyperlinked by wrapping
it in an <a>
.
Apply
encodeHeadedCellTable Source #
:: Foldable f | |
=> Attribute | Attributes of |
-> Colonnade Headed (Cell site) a | How to encode data as a row |
-> f a | Rows of data |
-> WidgetT site IO () |
If you are using the bootstrap css framework, then you may want to call this with the first argument as:
encodeHeadedCellTable (HA.class_ "table table-striped") ...
encodeDefinitionTable Source #
:: Attribute | Attributes of |
-> Colonnade Headed (Cell site) a | How to encode data as a row |
-> a | The value to display |
-> WidgetT site IO () |
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
.
:: (WidgetT site IO () -> WidgetT site IO ()) | Wrapper for items, often |
-> (WidgetT site IO () -> WidgetT site IO () -> WidgetT site IO ()) | Combines header with data |
-> Colonnade Headed (Cell site) a | How to encode data as a row |
-> a | The value to display |
-> WidgetT site IO () |
This determines the attributes that are added
to the individual li
s by concatenating the header's
attributes with the data's attributes.