feat: Refactor notes functionality into blueprint
- Moved notes-related routes (viewing/editing workout notes) from `app.py` into a new blueprint at `routes/notes.py`. - Integrated notes-specific database logic (fetching and updating notes) directly into `routes/notes.py` helper functions, removing the corresponding methods from `db.py` for better encapsulation. - Registered the new `notes_bp` blueprint in `app.py`. - Removed the original notes route definitions from `app.py`. - Updated `url_for` calls in `templates/partials/workout_note.html` to reference the new blueprint endpoints (e.g., `notes.get_person_notes`). - Updated `templates/changelog/changelog.html` to document this refactoring in its own entry.
This commit is contained in:
@@ -10,6 +10,24 @@
|
||||
<div class="prose max-w-none">
|
||||
<p>Updates and changes to the site will be documented here, with the most recent changes listed first.</p>
|
||||
|
||||
<!-- New Entry for Calendar Year View Fix -->
|
||||
<hr class="my-6">
|
||||
<h2 class="text-xl font-semibold mb-2">March 31, 2025</h2>
|
||||
<ul class="list-disc pl-5 space-y-1">
|
||||
<li>Fixed `AttributeError` in calendar year view caused by passing a date string instead of a date
|
||||
object to the template.</li>
|
||||
</ul>
|
||||
|
||||
<!-- New Entry for Notes Refactoring -->
|
||||
<hr class="my-6">
|
||||
<h2 class="text-xl font-semibold mb-2">March 31, 2025</h2>
|
||||
<ul class="list-disc pl-5 space-y-1">
|
||||
<li>Refactored notes functionality (viewing/editing workout notes) into its own blueprint
|
||||
(`routes/notes.py`).</li>
|
||||
<li>Moved notes-specific database logic from `db.py` into the `routes/notes.py` blueprint for better
|
||||
encapsulation.</li>
|
||||
</ul>
|
||||
|
||||
<!-- New Entry for Refactoring -->
|
||||
<hr class="my-6">
|
||||
<h2 class="text-xl font-semibold mb-2">March 30, 2025</h2>
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
{% if note|length > 0 %}
|
||||
<span class="text-base font-normal text-gray-500 whitespace-normal">{{ note | replace('\n', '<br>') | safe }}</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_note_edit_form', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-get="{{ url_for('notes.get_workout_note_edit_form', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-target="#workout-note-{{workout_id}}">
|
||||
Edit
|
||||
</a>
|
||||
{% else %}
|
||||
<a class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2 cursor-pointer float-none sm:float-right"
|
||||
hx-get="{{ url_for('get_workout_note_edit_form', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-get="{{ url_for('notes.get_workout_note_edit_form', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-target="#workout-note-{{workout_id}}">
|
||||
Add note
|
||||
</a>
|
||||
@@ -24,7 +24,7 @@
|
||||
<div class="flex flex-col">
|
||||
<button
|
||||
class="inline-flex justify-center p-2 text-blue-600 rounded-full cursor-pointer hover:bg-blue-100 dark:text-blue-500 dark:hover:bg-gray-600"
|
||||
hx-get="{{ url_for('get_workout_note', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-get="{{ url_for('notes.get_workout_note', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-target="#workout-note-{{workout_id}}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
stroke="currentColor" class="w-6 h-6">
|
||||
@@ -34,7 +34,7 @@
|
||||
</button>
|
||||
<button
|
||||
class="inline-flex justify-center p-2 text-blue-600 rounded-full cursor-pointer hover:bg-blue-100 dark:text-blue-500 dark:hover:bg-gray-600"
|
||||
hx-put="{{ url_for('update_workout_note', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-put="{{ url_for('notes.update_workout_note', person_id=person_id, workout_id=workout_id) }}"
|
||||
hx-include="[name='note']">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
stroke="currentColor" class="w-6 h-6">
|
||||
|
||||
Reference in New Issue
Block a user