Initial project setup

This commit is contained in:
Arne Weiss
2022-09-02 22:40:21 +02:00
commit ce35c0300c
41 changed files with 1127 additions and 0 deletions

39
Web/View/Entries/Index.hs Normal file
View 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>
|]