From de8b6f67a30f6c8accac75dc11eed152f8fbc931 Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Fri, 26 Sep 2025 15:25:12 -0400 Subject: [PATCH] Refactor ride filters and forms to use AlpineJS for state management and HTMX for AJAX interactions - Enhanced filter sidebar with AlpineJS for collapsible sections and localStorage persistence. - Removed custom JavaScript in favor of AlpineJS for managing filter states and interactions. - Updated ride form to utilize AlpineJS for handling manufacturer, designer, and ride model selections. - Simplified search script to leverage AlpineJS for managing search input and suggestions. - Improved error handling for HTMX requests with minimal JavaScript. - Refactored ride form data handling to encapsulate logic within an AlpineJS component. --- .clinerules/thrillwiki-simple.md | 2 + templates/maps/partials/location_card.html | 88 +-- templates/parks/partials/location_widget.html | 502 ++++++++-------- templates/parks/roadtrip_planner.html | 431 +++++--------- templates/rides/partials/filter_sidebar.html | 220 +++---- templates/rides/partials/ride_form.html | 39 +- templates/rides/partials/search_script.html | 538 ++++-------------- templates/rides/ride_form.html | 58 +- 8 files changed, 706 insertions(+), 1172 deletions(-) diff --git a/.clinerules/thrillwiki-simple.md b/.clinerules/thrillwiki-simple.md index fd58890e..f27b9f9c 100644 --- a/.clinerules/thrillwiki-simple.md +++ b/.clinerules/thrillwiki-simple.md @@ -51,4 +51,6 @@ tailwindcss, django, django-cotton, htmx, alpinejs, django-rest-framework, postg - RichChoiceField over Django choices - Progressive enhancement required +- We prefer to edit existing files instead of creating new ones. + YOU ARE STRICTLY AND ABSOLUTELY FORBIDDEN FROM IGNORING, BYPASSING, OR AVOIDING THESE RULES IN ANY WAY WITH NO EXCEPTIONS!!! \ No newline at end of file diff --git a/templates/maps/partials/location_card.html b/templates/maps/partials/location_card.html index 96851c66..bdbfe7d4 100644 --- a/templates/maps/partials/location_card.html +++ b/templates/maps/partials/location_card.html @@ -3,7 +3,8 @@ {% if location.id %}data-location-id="{{ location.id }}"{% endif %} {% if location.type %}data-location-type="{{ location.type }}"{% endif %} {% if location.latitude and location.longitude %}data-lat="{{ location.latitude }}" data-lng="{{ location.longitude }}"{% endif %} - {% if clickable %}onclick="{{ onclick_action|default:'window.location.href=\''|add:location.get_absolute_url|add:'\'' }}"{% endif %}> + x-data="locationCard()" + {% if clickable %}@click="handleCardClick('{{ location.get_absolute_url }}')"{% endif %}>
@@ -69,7 +70,7 @@ {% endif %} {% if show_map_action %} -
-
- -

Add parks to start planning your trip

-

Search above or click parks on the map

-
+ + +
- -
-