From f8907c7778023073e7c27a200d51420ce561a2d8 Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Fri, 26 Sep 2025 13:46:48 -0400 Subject: [PATCH] Refactor park and ride detail templates to utilize Alpine.js for state management in photo galleries and upload modals. Enhanced photo handling and initialization logic for improved user experience. --- templates/parks/park_detail.html | 83 +++++++++-------- templates/parks/park_form.html | 147 +++---------------------------- templates/rides/ride_detail.html | 25 +++++- 3 files changed, 81 insertions(+), 174 deletions(-) diff --git a/templates/parks/park_detail.html b/templates/parks/park_detail.html index ee6473ae..f7159434 100644 --- a/templates/parks/park_detail.html +++ b/templates/parks/park_detail.html @@ -12,14 +12,6 @@ {% endblock %} {% block content %} -
@@ -141,7 +133,16 @@ {% if park.photos.exists %} -
+

Photos

{% include "media/partials/photo_display.html" with photos=park.photos.all content_type="parks.park" object_id=park.id %}
@@ -188,10 +189,12 @@

Location

{% with location=park.location.first %} {% if location.latitude is not None and location.longitude is not None %} -
+
+
{% else %}
@@ -239,13 +242,7 @@ {% if perms.media.add_photo %}
- - - + {% if park.location.exists %} - +{% endif %} - -{% endif %} {% endblock %} diff --git a/templates/parks/park_form.html b/templates/parks/park_form.html index d246287d..b170b24b 100644 --- a/templates/parks/park_form.html +++ b/templates/parks/park_form.html @@ -26,7 +26,7 @@ {% if is_edit %}Edit{% else %}Create{% endif %} Park -
+ {% csrf_token %} {# Basic Information #} @@ -81,7 +81,10 @@
@@ -101,7 +104,7 @@ accept="image/*" class="hidden" x-ref="fileInput" - @change="handleFileSelect"> + @change="handleFileSelect($event)">
@@ -224,8 +228,8 @@ {% block extra_js %} {% endblock %} diff --git a/templates/rides/ride_detail.html b/templates/rides/ride_detail.html index bf14548f..908a29d1 100644 --- a/templates/rides/ride_detail.html +++ b/templates/rides/ride_detail.html @@ -149,7 +149,16 @@ {% if ride.photos.exists %} -
+

Photos

{% include "media/partials/photo_display.html" with photos=ride.photos.all content_type="rides.ride" object_id=ride.id %}
@@ -435,7 +444,7 @@ {% if perms.media.add_photo %}
+ {% endblock %}