Make workout and person pages htmx driven

This commit is contained in:
Peter Stockings
2022-11-24 21:19:16 +11:00
parent 7788fb9216
commit 339781355d
4 changed files with 142 additions and 132 deletions

View File

@@ -7,11 +7,10 @@
<span class="text-base font-normal text-gray-500">List of workouts</span>
</div>
<div>
<form action="{{ url_for('create_workout', person_id=person['PersonId']) }}" method="post">
<button
class="sm:inline-flex text-white bg-cyan-600 hover:bg-cyan-700 focus:ring-4 focus:ring-cyan-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mt-6">New
workout</button>
</form>
<button
class="sm:inline-flex text-white bg-cyan-600 hover:bg-cyan-700 focus:ring-4 focus:ring-cyan-200 font-medium rounded-lg text-sm px-5 py-2.5 text-center items-center mt-6"
hx-post="{{ url_for('create_workout', person_id=person['PersonId']) }}" hx-target="#container">New
workout</button>
</div>
</div>
@@ -77,18 +76,17 @@
{% endfor %}
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
<a href="{{ url_for('get_workout' ,person_id=person['PersonId'], workout_id=w['WorkoutId']) }}"
<a hx-get="{{ url_for('get_workout' ,person_id=person['PersonId'], workout_id=w['WorkoutId']) }}"
hx-target="#container" hx-push-url="true"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2 cursor-pointer">
Edit
</a>
<form
action="{{ url_for('delete_workout', person_id=person['PersonId'], workout_id=w['WorkoutId']) }}"
method="delete" class="inline">
<button
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2 cursor-pointer"
type="submit">Delete</button>
</form>
<button
hx-delete="{{ url_for('delete_workout', person_id=person['PersonId'], workout_id=w['WorkoutId']) }}"
hx-target="#container" hx-push-url="true"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2 cursor-pointer"
type="submit">Delete</button>
</td>
</tr>
{% endfor %}