Add edit and new for users
This commit is contained in:
+12
-20
@@ -1,9 +1,13 @@
|
||||
{% extends "base.html" %}
|
||||
{% import "components/typography.html" as typography %}
|
||||
{% import "components/dropdown.html" as dropdown %}
|
||||
{% import "components/cards.html" as cards %}
|
||||
{% import "components/inputs.html" as form_helpers %}
|
||||
|
||||
{% block main %}
|
||||
{{ typography::heading("All users") }}
|
||||
{% call typography::heading("All users") %}
|
||||
<a class="btn-success btn" href="/users/new">Add User</a>
|
||||
{% endcall %}
|
||||
|
||||
{% call cards::card() %}
|
||||
<table class="table table-hover">
|
||||
@@ -17,30 +21,18 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for (user, book_size, borrowed_book) in user_with_books_number %}
|
||||
{% for user_information in user_with_books_number %}
|
||||
<tr>
|
||||
<th scope="row">{{ user.id }}</th>
|
||||
<td>{{ user.name }}</td>
|
||||
<td>{{ book_size }}</td>
|
||||
<td>{{ borrowed_book }}</td>
|
||||
<th scope="row">{{ user_information.user.id }}</th>
|
||||
<td>{{ user_information.user.name }}</td>
|
||||
<td>{{ user_information.owner_book_number }}</td>
|
||||
<td>{{ user_information.borrowed_book_number }}</td>
|
||||
<td>
|
||||
<form method="post" action="/users/{{ user.id }}">
|
||||
<input value="Delete" type="submit" class="btn btn-danger btn-sm">
|
||||
</form>
|
||||
{{ dropdown::crud_dropdown_button(user_information.user, "Actions", "users", show = false) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
{% endcall %}
|
||||
|
||||
{% call cards::card() %}
|
||||
<form action="/users" method="post">
|
||||
<label class="form-label">Name</label>
|
||||
<input type="text" name="name" class="form-control">
|
||||
|
||||
<input type="submit" value="Create user" class="btn btn-success mt-3">
|
||||
</form>
|
||||
{% endcall %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user