Initial project setup
This commit is contained in:
39
Web/View/Entries/Index.hs
Normal file
39
Web/View/Entries/Index.hs
Normal file
@@ -0,0 +1,39 @@
|
||||
module Web.View.Entries.Index where
|
||||
import Web.View.Prelude
|
||||
|
||||
data IndexView = IndexView { entries :: [Entry] }
|
||||
|
||||
instance View IndexView where
|
||||
html IndexView { .. } = [hsx|
|
||||
{breadcrumb}
|
||||
|
||||
<h1>Index<a href={pathTo NewEntryAction} class="btn btn-primary ml-4">+ New</a></h1>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Entry</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>{forEach entries renderEntry}</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|]
|
||||
where
|
||||
breadcrumb = renderBreadcrumb
|
||||
[ breadcrumbLink "Entries" EntriesAction
|
||||
]
|
||||
|
||||
renderEntry :: Entry -> Html
|
||||
renderEntry entry = [hsx|
|
||||
<tr>
|
||||
<td>{entry}</td>
|
||||
<td><a href={ShowEntryAction entry.id}>Show</a></td>
|
||||
<td><a href={EditEntryAction entry.id} class="text-muted">Edit</a></td>
|
||||
<td><a href={DeleteEntryAction entry.id} class="js-delete text-muted">Delete</a></td>
|
||||
</tr>
|
||||
|]
|
||||
Reference in New Issue
Block a user