Move add user form from navbar to under user list and add icon to navbar

This commit is contained in:
Peter Stockings
2023-03-11 17:21:56 +11:00
parent eb8c8c2532
commit 762af9caef
2 changed files with 46 additions and 15 deletions

View File

@@ -8,15 +8,30 @@
<tbody>
{% for u in users %}
<tr class="hover:bg-gray-100">
<td class="py-4 px-6 border-b border-gray-200"><a href="{{ url_for('new_workout', user_id=u.id) }}">{{
u.name }}</a></td>
<td class="py-4 px-6 border-b border-gray-200">
<a href="{{ url_for('new_workout', user_id=u.id) }}">
<div class="flex">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6 pr-2" data-darkreader-inline-stroke=""
style="--darkreader-inline-stroke:currentColor;">
<path stroke-linecap="round" stroke-linejoin="round"
d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z">
</path>
</svg>
<div>
{{ u.name }}
</div>
</div>
</a>
</td>
<td class="py-4 px-6 border-b border-gray-200 flex inline">
<div class="flex justify-between w-full">
<div>{{ u.workouts_count }}</div>
<div class="flex">
<div hx-delete="{{ url_for('delete_user', user_id=u.id) }}"
hx-confirm="Are you sure you wish to delete your account?" hx-target="#users-container"
class="pr-1">
class="pr-2">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round"
@@ -38,4 +53,18 @@
</tr>
{% endfor %}
</tbody>
</table>
</table>
<form class="w-full" hx-post="{{ url_for('users') }}" hx-target="#users-container">
<div class="flex items-center border-b border-teal-500 py-2">
<input
class="appearance-none bg-transparent border-none w-full text-gray-700 mr-3 py-1 px-2 leading-tight focus:outline-none"
type="text" placeholder="Jane Doe" aria-label="Full name" name="name" required>
<button
class="flex-shrink-0 bg-teal-500 hover:bg-teal-700 border-teal-500 hover:border-teal-700 text-sm border-4 text-white py-1 px-2 rounded"
type="submit">
Add
</button>
</div>
</form>