Switch from using workout modal and change to workout page, still need to cleanup modal logic and templates. Need to fix workout tag functionality

This commit is contained in:
Peter Stockings
2024-11-04 22:02:06 +11:00
parent 1a970d1d7b
commit 10326ccd7a
8 changed files with 106 additions and 116 deletions

View File

@@ -1,11 +1,11 @@
{% if exercises %}
<ul class="list-none m-0 p-0 max-h-[300px] overflow-y-auto">
<ul class="list-none m-0 p-0 max-h-[300px] overflow-y-auto border border-gray-200">
{% for exercise in exercises %}
{{ render_partial('partials/exercise/exercise_list_item.html', exercise=exercise) }}
{{ render_partial('partials/exercise/exercise_list_item.html', exercise=exercise, person_id=person_id) }}
{% endfor %}
</ul>
{% else %}
<div class="py-2 px-4 text-gray-500 flex items-center justify-between">
<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"

View File

@@ -1,4 +1,8 @@
<li class="py-2 px-4 hover:bg-gray-100 cursor-pointer flex items-center justify-between">
<li class="py-2 px-4 hover:bg-gray-100 cursor-pointer flex items-center justify-between"
_="on click set the innerHTML of #exercise-results to ''
then set the value of #exercise-search to '{{ exercise.name }}'
then set the value of #selected-exercise to '{{ exercise.exercise_id }}'
on click call htmx.ajax('GET', '{{ url_for('get_exercise_progress_for_user', person_id=person_id, exercise_id=exercise.exercise_id) }}', {target:'#exercise-progress', swap:'innerHTML'})">
<!-- Exercise Name -->
<span>{{ exercise.name }}</span>
<!-- Edit Icon -->

View File

@@ -0,0 +1,15 @@
<div class="relative" _="on click from elsewhere set the innerHTML of #exercise-results to ''">
<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="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">
<!-- Dropdown Menu -->
<div id="exercise-results" class="absolute w-full bg-white mt-1 rounded shadow-md z-10">
<!-- Results will be injected here -->
</div>
<input type="hidden" name="exercise_id" id="selected-exercise">
</div>