Fix issue selecting a new exercise

This commit is contained in:
Peter Stockings
2025-01-19 21:34:45 +11:00
parent da73d816d6
commit 5ffb08a994
4 changed files with 16 additions and 15 deletions

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="search" name="query" placeholder="Search exercises..."
hx-get="{{ url_for('get_exercises', person_id=person_id) }}" hx-target="#exercise-results"
hx-trigger="keyup changed delay:500ms" hx-swap="innerHTML" autocomplete="off" {% if has_value==True %}
hx-trigger="keyup changed delay:500ms" hx-swap="innerHTML" autocomplete="off" {% if exercise_name %}
value="{{ exercise_name }}" {% endif %} _="
on input
if this.value is empty
@@ -15,7 +15,7 @@
<!-- Results will be injected here -->
</div>
<input type="hidden" name="exercise_id" id="selected-exercise" {% if has_value==True %} value="{{ exercise_id }}" {%
<input type="hidden" name="exercise_id" id="selected-exercise" {% if exercise_id %} value="{{ exercise_id }}" {%
endif %}>
</div>

View File

@@ -12,7 +12,7 @@
<label class="block uppercase tracking-wide text-gray-700 text-xs font-bold mb-2" for="grid-state">
Exercise
</label>
{{ render_partial('partials/exercise/exercise_select.html', person_id=person_id, has_value=has_value,
{{ render_partial('partials/exercise/exercise_select.html', person_id=person_id,
exercise_id=exercise_id, exercise_name=exercise_name) }}
</div>
@@ -22,7 +22,7 @@
</label>
<input
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="grid-city" type="number" name="repetitions" {% if has_value==True %} placeholder="{{ repetitions }}"
id="grid-city" type="number" name="repetitions" {% if repetitions %} placeholder="{{ repetitions }}"
_="on clearNewSetInputs set my.placeholder to ''" {% endif %}>
</div>
@@ -32,7 +32,7 @@
</label>
<input
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="grid-zip" type="number" name="weight" step="any" {% if has_value==True %} placeholder="{{ weight }}"
id="grid-zip" type="number" name="weight" step="any" {% if weight %} placeholder="{{ weight }}"
_="on clearNewSetInputs set my.placeholder to ''" {% endif %}>
</div>