mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 11:31:07 -05:00
Fix moderation submission display:
- Add location map template for view mode - Add coaster fields template for stats - Fix location and stats display in both view and edit modes
This commit is contained in:
23
templates/moderation/partials/location_map.html
Normal file
23
templates/moderation/partials/location_map.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% load moderation_tags %}
|
||||
|
||||
<div class="p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50">
|
||||
<h3 class="mb-4 text-lg font-semibold">Location</h3>
|
||||
<div class="h-[300px] w-full rounded-lg border border-gray-300 dark:border-gray-600"
|
||||
id="viewMap-{{ submission.id }}"
|
||||
x-init="setTimeout(() => {
|
||||
const map = L.map('viewMap-{{ submission.id }}').setView([{{ location.latitude }}, {{ location.longitude }}], 13);
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© OpenStreetMap contributors'
|
||||
}).addTo(map);
|
||||
L.marker([{{ location.latitude }}, {{ location.longitude }}]).addTo(map);
|
||||
}, 100)"></div>
|
||||
<div class="mt-4 space-y-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
{% if location.street_address %}<div>{{ location.street_address }}</div>{% endif %}
|
||||
<div>
|
||||
{% if location.city %}{{ location.city }}{% endif %}
|
||||
{% if location.state %}, {{ location.state }}{% endif %}
|
||||
{% if location.postal_code %} {{ location.postal_code }}{% endif %}
|
||||
</div>
|
||||
{% if location.country %}<div>{{ location.country }}</div>{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -104,7 +104,7 @@
|
||||
<div x-show="!isEditing"
|
||||
class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||
{% for field, value in submission.changes.items %}
|
||||
{% if field != 'model_name' %}
|
||||
{% if field != 'model_name' and field != 'latitude' and field != 'longitude' and field != 'street_address' and field != 'city' and field != 'state' and field != 'postal_code' and field != 'country' %}
|
||||
<div class="p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50">
|
||||
<div class="text-sm font-medium text-gray-900 dark:text-gray-300">
|
||||
{{ field|title }}:
|
||||
@@ -160,6 +160,13 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- Location Map (View Mode) -->
|
||||
{% if submission.content_type.model == 'park' and submission.changes.latitude and submission.changes.longitude %}
|
||||
<div class="col-span-2">
|
||||
{% include "moderation/partials/location_map.html" with location=submission.changes %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Edit Mode -->
|
||||
@@ -169,7 +176,7 @@
|
||||
hx-target="#submission-{{ submission.id }}"
|
||||
class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||
{% for field, value in submission.changes.items %}
|
||||
{% if field != 'model_name' and field != 'stats' %}
|
||||
{% if field != 'model_name' and field != 'stats' and field != 'latitude' and field != 'longitude' and field != 'street_address' and field != 'city' and field != 'state' and field != 'postal_code' and field != 'country' %}
|
||||
<div class="p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50"
|
||||
{% if field == 'post_closing_status' %}x-show="status === 'CLOSING'"{% endif %}
|
||||
{% if field == 'closing_date' %}x-show="['CLOSING', 'SBNO', 'CLOSED_PERM', 'DEMOLISHED', 'RELOCATED'].includes(status)"{% endif %}>
|
||||
@@ -356,8 +363,7 @@
|
||||
|
||||
<!-- Location Widget for Parks -->
|
||||
{% if submission.content_type.model == 'park' %}
|
||||
<div class="col-span-2 p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50">
|
||||
<h3 class="mb-4 text-lg font-semibold">Location</h3>
|
||||
<div class="col-span-2">
|
||||
{% include "moderation/partials/location_widget.html" with form=submission.changes %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user