module Web.View.Tasks.Index where
import Web.View.Prelude
data IndexView = IndexView { tasks :: [Include "tags" Task] }
instance View IndexView where
html IndexView { .. } = [hsx|
Task |
|
|
|
{forEach tasks renderTask}
|]
where
breadcrumb = renderBreadcrumb
[ breadcrumbLink "Tasks" TasksAction
]
renderTask :: Include "tags" Task -> Html
renderTask task = [hsx|
{task.description} |
{renderTags task.tags} |
Show |
Edit |
Delete |
|]
renderTags :: [Tag] -> Text
renderTags tags =
tags
|> map (.name)
|> intercalate ", "