Add (partially-) working categoryManager.

- Added Body-Parser.
This commit is contained in:
2023-05-08 23:30:19 +02:00
parent 43ef7fd395
commit 7cfca9abac
5 changed files with 119 additions and 13 deletions

View File

@ -5,10 +5,41 @@
<!-- Create new category button -->
<div class="row">
<div class="col-12">
<a href="/settings/category/new" class="btn btn-primary">Create new category</a>
</div>
<a href="/settings/category/new" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#createNewCategoryModal">Create new category</a>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="createNewCategoryModal" tabindex="-1" aria-labelledby="createNewCategoryModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="createNewCategoryModalLabel">Create a new category</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form method="post">
<div class="mb-3">
<label for="createNewCategoryModalName" class="form-label">Name</label>
<input type="text" class="form-control" id="createNewCategoryModalName" name="name" required />
<div id="createNewCategoryModalNameText" class="form-text">This name should be unqiue.</div>
</div>
<div class="mb-3">
<label for="createNewCategoryModalDescription" class="form-label">Description</label>
<input type="text" class="form-control" id="createNewCategoryModalDescription" name="description" />
<div id="createNewCategoryModalDescText" class="form-text">Optional</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</form>
</div>
</div>
</div>
<!-- Table with all categories -->
<table class="table">
<thead>
@ -23,7 +54,8 @@
<tr>
<th scope="row"><%= user.id %></th>
<td><%= user.name %></td>
<td><%= user.description %></td> </tr>
<td><%= user.description %></td>
</tr>
<% }) %>
</tbody>
</table>