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:
pacnpal
2024-11-14 02:16:04 +00:00
parent 2614ce44e3
commit 35857dd147
2 changed files with 114 additions and 85 deletions

View 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>