Fix error thrown when attempting to update exercise name

This commit is contained in:
Peter Stockings
2024-11-04 23:14:56 +11:00
parent 1f0742bbc0
commit 5938c9468b
5 changed files with 15 additions and 12 deletions

View File

@@ -4,9 +4,9 @@
class="w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-2 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
_="on click from me call event.stopPropagation()">
<!-- Save Icon -->
<button hx-post="{{ url_for('edit_exercise_name', exercise_id=exercise.exercise_id) }}" hx-target="closest li"
hx-swap="outerHTML" hx-include="closest li" class="text-gray-500 hover:text-gray-700 ml-2"
_="on click from me call event.stopPropagation()">
<button hx-post="{{ url_for('edit_exercise_name', exercise_id=exercise.exercise_id, person_id=person_id) }}"
hx-target="closest li" hx-swap="outerHTML" hx-include="closest li"
class="text-gray-500 hover:text-gray-700 ml-2" _="on click from me call event.stopPropagation()">
<!-- Tick icon SVG -->
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"
stroke-width="2">
@@ -14,8 +14,8 @@
</svg>
</button>
<!-- Delete Icon -->
<button hx-delete="{{ url_for('delete_exercise', exercise_id=exercise.exercise_id) }}" hx-target="closest li"
hx-swap="outerHTML" class="text-red-500 hover:text-red-700 ml-2"
<button hx-delete="{{ url_for('delete_exercise', exercise_id=exercise.exercise_id, person_id=person_id) }}"
hx-target="closest li" hx-swap="outerHTML" class="text-red-500 hover:text-red-700 ml-2"
hx-confirm="Are you sure you wish to delete {{ exercise.name }} from exercises?"
_="on click from me call event.stopPropagation()">
<!-- Trash icon SVG -->

View File

@@ -8,7 +8,7 @@
<div class="py-2 px-4 text-gray-500 flex items-center justify-between border border-gray-200">
<span>No results found</span>
<!-- Add Exercise Button -->
<button hx-post="{{ url_for('add_exercise') }}" hx-target="closest div" hx-swap="outerHTML"
<button hx-post="{{ url_for('add_exercise', person_id=person_id) }}" hx-target="closest div" hx-swap="outerHTML"
hx-include="[name='query']" class="text-blue-500 hover:text-blue-700 font-semibold"
_="on click from me call event.stopPropagation()">
Add Exercise

View File

@@ -6,8 +6,9 @@
<!-- Exercise Name -->
<span>{{ exercise.name }}</span>
<!-- Edit Icon -->
<a hx-get="{{ url_for('edit_exercise_name', exercise_id=exercise.exercise_id) }}" hx-target="closest li"
hx-swap="outerHTML" class="text-gray-500 hover:text-gray-700" _="on click from me call event.stopPropagation()">
<a hx-get="{{ url_for('edit_exercise_name', exercise_id=exercise.exercise_id, person_id=person_id) }}"
hx-target="closest li" hx-swap="outerHTML" class="text-gray-500 hover:text-gray-700"
_="on click from me call event.stopPropagation()">
<!-- Edit icon SVG -->
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"
stroke-width="2">

View File

@@ -3,7 +3,7 @@
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500"
id="exercise-search" type="text" name="query" placeholder="Search exercises..."
hx-get="{{ url_for('get_exercises', person_id=person_id) }}" hx-target="#exercise-results"
hx-trigger="keyup changed delay:200ms" autocomplete="off">
hx-trigger="keyup changed delay:500ms" hx-swap="innerHTML" autocomplete="off">
<!-- Dropdown Menu -->
<div id="exercise-results" class="absolute w-full bg-white mt-1 rounded shadow-md z-10">