mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 14:51:08 -05:00
Fix moderation submission display:
- Fix location map display in view mode - Remove duplicate location map - Fix grid layout and closing tags - Show location map before other fields
This commit is contained in:
@@ -100,84 +100,85 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- View Mode -->
|
<!-- View Mode -->
|
||||||
<div x-show="!isEditing"
|
<div x-show="!isEditing">
|
||||||
class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
<!-- Location Map (View Mode) -->
|
||||||
{% for field, value in submission.changes.items %}
|
{% if submission.content_type.model == 'park' and submission.changes.latitude and submission.changes.longitude %}
|
||||||
{% 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="mb-4">
|
||||||
<div class="p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50">
|
{% include "moderation/partials/location_map.html" with location=submission.changes %}
|
||||||
<div class="text-sm font-medium text-gray-900 dark:text-gray-300">
|
</div>
|
||||||
{{ field|title }}:
|
|
||||||
</div>
|
|
||||||
<div class="mt-1.5 text-gray-600 dark:text-gray-400">
|
|
||||||
{% if field == 'opening_date' or field == 'closing_date' or field == 'status_since' %}
|
|
||||||
{{ value|date:"Y-m-d" }}
|
|
||||||
{% elif field == 'size_acres' %}
|
|
||||||
{{ value }} acres
|
|
||||||
{% elif field == 'website' %}
|
|
||||||
<a href="{{ value }}" target="_blank" class="text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300">
|
|
||||||
{{ value }}
|
|
||||||
</a>
|
|
||||||
{% elif field == 'park' %}
|
|
||||||
{% with park_name=value|get_object_name:'parks.Park' %}
|
|
||||||
{{ park_name }}
|
|
||||||
{% endwith %}
|
|
||||||
{% elif field == 'designer' %}
|
|
||||||
{% with designer_name=value|get_object_name:'designers.Designer' %}
|
|
||||||
{{ designer_name|default:'None' }}
|
|
||||||
{% endwith %}
|
|
||||||
{% elif field == 'manufacturer' %}
|
|
||||||
{% with manufacturer_name=value|get_object_name:'companies.Manufacturer' %}
|
|
||||||
{{ manufacturer_name|default:'None' }}
|
|
||||||
{% endwith %}
|
|
||||||
{% elif field == 'ride_model' %}
|
|
||||||
{% with model_name=value|get_object_name:'rides.RideModel' %}
|
|
||||||
{{ model_name|default:'None' }}
|
|
||||||
{% endwith %}
|
|
||||||
{% elif field == 'park_area' %}
|
|
||||||
{% with park_id=submission.changes.park %}
|
|
||||||
{{ value|get_park_area_name:park_id|default:'None' }}
|
|
||||||
{% endwith %}
|
|
||||||
{% elif field == 'category' %}
|
|
||||||
{{ value|get_category_display }}
|
|
||||||
{% elif field == 'stats' %}
|
|
||||||
<div class="space-y-2">
|
|
||||||
{% if value.height_ft %}<div>Height: {{ value.height_ft }} ft</div>{% endif %}
|
|
||||||
{% if value.length_ft %}<div>Length: {{ value.length_ft }} ft</div>{% endif %}
|
|
||||||
{% if value.speed_mph %}<div>Speed: {{ value.speed_mph }} mph</div>{% endif %}
|
|
||||||
{% if value.inversions %}<div>Inversions: {{ value.inversions }}</div>{% endif %}
|
|
||||||
{% if value.launch_type %}<div>Launch Type: {{ value.launch_type }}</div>{% endif %}
|
|
||||||
{% if value.track_material %}<div>Track Material: {{ value.track_material }}</div>{% endif %}
|
|
||||||
{% if value.roller_coaster_type %}<div>Type: {{ value.roller_coaster_type }}</div>{% endif %}
|
|
||||||
{% if value.trains_count %}<div>Number of Trains: {{ value.trains_count }}</div>{% endif %}
|
|
||||||
{% if value.cars_per_train %}<div>Cars per Train: {{ value.cars_per_train }}</div>{% endif %}
|
|
||||||
{% if value.seats_per_car %}<div>Seats per Car: {{ value.seats_per_car }}</div>{% endif %}
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
{{ value }}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||||
|
{% for field, value in submission.changes.items %}
|
||||||
|
{% 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 }}:
|
||||||
|
</div>
|
||||||
|
<div class="mt-1.5 text-gray-600 dark:text-gray-400">
|
||||||
|
{% if field == 'opening_date' or field == 'closing_date' or field == 'status_since' %}
|
||||||
|
{{ value|date:"Y-m-d" }}
|
||||||
|
{% elif field == 'size_acres' %}
|
||||||
|
{{ value }} acres
|
||||||
|
{% elif field == 'website' %}
|
||||||
|
<a href="{{ value }}" target="_blank" class="text-blue-600 hover:text-blue-500 dark:text-blue-400 dark:hover:text-blue-300">
|
||||||
|
{{ value }}
|
||||||
|
</a>
|
||||||
|
{% elif field == 'park' %}
|
||||||
|
{% with park_name=value|get_object_name:'parks.Park' %}
|
||||||
|
{{ park_name }}
|
||||||
|
{% endwith %}
|
||||||
|
{% elif field == 'designer' %}
|
||||||
|
{% with designer_name=value|get_object_name:'designers.Designer' %}
|
||||||
|
{{ designer_name|default:'None' }}
|
||||||
|
{% endwith %}
|
||||||
|
{% elif field == 'manufacturer' %}
|
||||||
|
{% with manufacturer_name=value|get_object_name:'companies.Manufacturer' %}
|
||||||
|
{{ manufacturer_name|default:'None' }}
|
||||||
|
{% endwith %}
|
||||||
|
{% elif field == 'ride_model' %}
|
||||||
|
{% with model_name=value|get_object_name:'rides.RideModel' %}
|
||||||
|
{{ model_name|default:'None' }}
|
||||||
|
{% endwith %}
|
||||||
|
{% elif field == 'park_area' %}
|
||||||
|
{% with park_id=submission.changes.park %}
|
||||||
|
{{ value|get_park_area_name:park_id|default:'None' }}
|
||||||
|
{% endwith %}
|
||||||
|
{% elif field == 'category' %}
|
||||||
|
{{ value|get_category_display }}
|
||||||
|
{% elif field == 'stats' %}
|
||||||
|
<div class="space-y-2">
|
||||||
|
{% if value.height_ft %}<div>Height: {{ value.height_ft }} ft</div>{% endif %}
|
||||||
|
{% if value.length_ft %}<div>Length: {{ value.length_ft }} ft</div>{% endif %}
|
||||||
|
{% if value.speed_mph %}<div>Speed: {{ value.speed_mph }} mph</div>{% endif %}
|
||||||
|
{% if value.inversions %}<div>Inversions: {{ value.inversions }}</div>{% endif %}
|
||||||
|
{% if value.launch_type %}<div>Launch Type: {{ value.launch_type }}</div>{% endif %}
|
||||||
|
{% if value.track_material %}<div>Track Material: {{ value.track_material }}</div>{% endif %}
|
||||||
|
{% if value.roller_coaster_type %}<div>Type: {{ value.roller_coaster_type }}</div>{% endif %}
|
||||||
|
{% if value.trains_count %}<div>Number of Trains: {{ value.trains_count }}</div>{% endif %}
|
||||||
|
{% if value.cars_per_train %}<div>Cars per Train: {{ value.cars_per_train }}</div>{% endif %}
|
||||||
|
{% if value.seats_per_car %}<div>Seats per Car: {{ value.seats_per_car }}</div>{% endif %}
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
{{ value }}
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<!-- Location Map (View Mode) -->
|
<!-- Edit Mode -->
|
||||||
{% if submission.content_type.model == 'park' and submission.changes.latitude and submission.changes.longitude %}
|
<form x-show="isEditing"
|
||||||
<div class="col-span-2">
|
x-cloak
|
||||||
{% include "moderation/partials/location_map.html" with location=submission.changes %}
|
hx-post="{% url 'moderation:edit_submission' submission.id %}"
|
||||||
</div>
|
hx-target="#submission-{{ submission.id }}"
|
||||||
{% endif %}
|
class="grid grid-cols-1 gap-3 md:grid-cols-2">
|
||||||
</div>
|
{% for field, value in submission.changes.items %}
|
||||||
|
{% 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' %}
|
||||||
<!-- Edit Mode -->
|
<div class="p-4 bg-gray-100 border rounded-lg dark:bg-gray-900 border-gray-200/50 dark:border-gray-700/50"
|
||||||
<form x-show="isEditing"
|
|
||||||
x-cloak
|
|
||||||
hx-post="{% url 'moderation:edit_submission' submission.id %}"
|
|
||||||
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' 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 == 'post_closing_status' %}x-show="status === 'CLOSING'"{% endif %}
|
||||||
{% if field == 'closing_date' %}x-show="['CLOSING', 'SBNO', 'CLOSED_PERM', 'DEMOLISHED', 'RELOCATED'].includes(status)"{% endif %}>
|
{% if field == 'closing_date' %}x-show="['CLOSING', 'SBNO', 'CLOSED_PERM', 'DEMOLISHED', 'RELOCATED'].includes(status)"{% endif %}>
|
||||||
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">
|
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300">
|
||||||
@@ -358,22 +359,22 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<!-- Location Widget for Parks -->
|
<!-- Location Widget for Parks -->
|
||||||
{% if submission.content_type.model == 'park' %}
|
{% if submission.content_type.model == 'park' %}
|
||||||
<div class="col-span-2">
|
<div class="col-span-2">
|
||||||
{% include "moderation/partials/location_widget.html" with form=submission.changes %}
|
{% include "moderation/partials/location_widget.html" with form=submission.changes %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Coaster Fields -->
|
<!-- Coaster Fields -->
|
||||||
<div x-show="showCoasterFields"
|
<div x-show="showCoasterFields"
|
||||||
x-cloak
|
x-cloak
|
||||||
class="col-span-2">
|
class="col-span-2">
|
||||||
{% include 'moderation/partials/coaster_fields.html' with stats=submission.changes.stats %}
|
{% include 'moderation/partials/coaster_fields.html' with stats=submission.changes.stats %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-span-2 p-4 border rounded-lg bg-blue-50 dark:bg-blue-900/30 border-blue-200/50 dark:border-blue-700/50">
|
<div class="col-span-2 p-4 border rounded-lg bg-blue-50 dark:bg-blue-900/30 border-blue-200/50 dark:border-blue-700/50">
|
||||||
<label class="block mb-2 text-sm font-medium text-blue-900 dark:text-blue-300">
|
<label class="block mb-2 text-sm font-medium text-blue-900 dark:text-blue-300">
|
||||||
@@ -397,7 +398,7 @@
|
|||||||
Save Changes
|
Save Changes
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Keep existing review notes section -->
|
<!-- Keep existing review notes section -->
|
||||||
{% if submission.notes %}
|
{% if submission.notes %}
|
||||||
@@ -441,56 +442,4 @@
|
|||||||
hx-target="#submissions-content"
|
hx-target="#submissions-content"
|
||||||
hx-include="closest .review-notes"
|
hx-include="closest .review-notes"
|
||||||
hx-confirm="Are you sure you want to approve this submission?"
|
hx-confirm="Are you sure you want to approve this submission?"
|
||||||
hx-indicator="#loading-indicator">
|
hx-indicator="#loading-indicator
|
||||||
<i class="mr-2 fas fa-check"></i>
|
|
||||||
Approve
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button class="inline-flex items-center px-4 py-2.5 font-medium text-white transition-all duration-200 bg-red-600 rounded-lg hover:bg-red-500 dark:bg-red-700 dark:hover:bg-red-600 shadow-sm hover:shadow-md"
|
|
||||||
hx-post="{% url 'moderation:reject_submission' submission.id %}"
|
|
||||||
hx-target="#submissions-content"
|
|
||||||
hx-include="closest .review-notes"
|
|
||||||
hx-confirm="Are you sure you want to reject this submission?"
|
|
||||||
hx-indicator="#loading-indicator">
|
|
||||||
<i class="mr-2 fas fa-times"></i>
|
|
||||||
Reject
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if user.role == 'MODERATOR' and submission.status != 'ESCALATED' %}
|
|
||||||
<button class="inline-flex items-center px-4 py-2.5 font-medium text-white transition-all duration-200 bg-yellow-600 rounded-lg hover:bg-yellow-500 dark:bg-yellow-700 dark:hover:bg-yellow-600 shadow-sm hover:shadow-md"
|
|
||||||
hx-post="{% url 'moderation:escalate_submission' submission.id %}"
|
|
||||||
hx-target="#submissions-content"
|
|
||||||
hx-include="closest .review-notes"
|
|
||||||
hx-confirm="Are you sure you want to escalate this submission?"
|
|
||||||
hx-indicator="#loading-indicator">
|
|
||||||
<i class="mr-2 fas fa-arrow-up"></i>
|
|
||||||
Escalate
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% empty %}
|
|
||||||
<div class="relative p-8 text-center bg-white border rounded-lg dark:bg-gray-800 border-gray-200/50 dark:border-gray-700/50">
|
|
||||||
<div class="text-gray-600 dark:text-gray-400">
|
|
||||||
<i class="mb-4 text-5xl fas fa-inbox"></i>
|
|
||||||
<p class="text-lg">No submissions found matching your filters.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="loading-indicator"
|
|
||||||
class="absolute inset-0 flex items-center justify-center rounded-lg htmx-indicator bg-white/80 dark:bg-gray-900/80">
|
|
||||||
<div class="flex items-center p-6 space-x-4">
|
|
||||||
<div class="w-8 h-8 border-4 border-blue-500 rounded-full animate-spin border-t-transparent"></div>
|
|
||||||
<span class="text-gray-900 dark:text-gray-300">Loading...</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
{% block extra_js %}
|
|
||||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user