module Web.View.Items.Index where
import Web.View.Prelude
data IndexView = IndexView { items :: [Include "tags" Item] }
instance View IndexView where
html IndexView { .. } = [hsx|
Item |
|
|
|
{forEach items renderItem}
|]
where
breadcrumb = renderBreadcrumb
[ breadcrumbLink "Items" ItemsAction
]
renderItem :: Include "tags" Item -> Html
renderItem item = [hsx|
{item.description} |
{renderTags item.tags} |
Show |
Edit |
Delete |
|]
renderTags :: [Tag] -> Text
renderTags tags =
tags
|> map (.name)
|> intercalate ", "