feat: Refactor workout functionality into blueprint

- Moved workout-related routes (create/delete/edit workouts, topsets, tags, start dates, show workout) from `app.py` into a new blueprint at `routes/workout.py`.
- Integrated workout view model logic from `features/workout.py` directly into `routes/workout.py` helper function `_get_workout_view_model`.
- Removed `features/workout.py` and the corresponding class instantiation in `db.py`.
- Registered the new `workout_bp` blueprint in `app.py`.
- Removed the original workout route definitions from `app.py`.
- Updated `url_for` calls in relevant templates (`workout.html`, `person_overview.html`, `partials/workout_tags.html`, `partials/topset.html`, `partials/start_date.html`, `partials/new_set_form.html`, `notes.html`, `calendar.html`) to reference the new blueprint endpoints (e.g., `workout.create_workout`).
- Updated `templates/changelog/changelog.html` to document this refactoring.
This commit is contained in:
Peter Stockings
2025-03-31 22:38:48 +11:00
parent 78436b230b
commit eaeb4ab2c8
13 changed files with 276 additions and 242 deletions

View File

@@ -2,7 +2,7 @@
{% if is_edit|default(false, true) == false %}
<span class="text-base font-normal text-gray-500">{{ strftime(start_date, "%b %d %Y") }}</span>
<a class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2 cursor-pointer"
hx-get="{{ url_for('get_workout_start_date_edit_form', person_id=person_id, workout_id=workout_id) }}"
hx-get="{{ url_for('workout.get_workout_start_date_edit_form', person_id=person_id, workout_id=workout_id) }}"
hx-target="#edit-start-date">
Edit
</a>
@@ -20,10 +20,10 @@
<input type="date"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5 w-full"
name="start-date" value="{{ start_date }}"
hx-put="{{ url_for('update_workout_start_date', person_id=person_id, workout_id=workout_id) }}">
hx-put="{{ url_for('workout.update_workout_start_date', person_id=person_id, workout_id=workout_id) }}">
</div>
<a hx-get="{{ url_for('get_workout_start_date', person_id=person_id, workout_id=workout_id) }}"
<a hx-get="{{ url_for('workout.get_workout_start_date', person_id=person_id, workout_id=workout_id) }}"
hx-target="#edit-start-date"
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2 cursor-pointer">
Cancel