1
0
Fork 0
compareware/Web/View/Tasks/Index.hs

37 lines
1.1 KiB
Haskell
Raw Normal View History

2023-04-16 10:33:20 +00:00
module Web.View.Tasks.Index where
import Web.View.Prelude
data IndexView = IndexView { tasks :: [Task] }
instance View IndexView where
html IndexView { .. } = [hsx|
2023-04-16 10:35:16 +00:00
<h1>Tasks<a href={pathTo NewTaskAction} class="btn btn-primary ms-4">+ New</a></h1>
2023-04-16 10:33:20 +00:00
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>Task</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>{forEach tasks renderTask}</tbody>
</table>
</div>
|]
where
breadcrumb = renderBreadcrumb
[ breadcrumbLink "Tasks" TasksAction
]
renderTask :: Task -> Html
renderTask task = [hsx|
<tr>
2023-04-16 10:35:16 +00:00
<td>{task.description}</td>
2023-04-16 10:33:20 +00:00
<td><a href={ShowTaskAction task.id}>Show</a></td>
<td><a href={EditTaskAction task.id} class="text-muted">Edit</a></td>
<td><a href={DeleteTaskAction task.id} class="js-delete text-muted">Delete</a></td>
</tr>
|]