mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 06:31:09 -05:00
yay
This commit is contained in:
@@ -6,43 +6,58 @@
|
||||
{% block content %}
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h1 class="text-3xl font-bold">Rides & Attractions</h1>
|
||||
<h1 class="text-3xl font-bold text-gray-900 dark:text-white">Rides & Attractions</h1>
|
||||
</div>
|
||||
|
||||
<!-- Filters -->
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-4 mb-6">
|
||||
<h2 class="text-xl font-semibold mb-4">Filters</h2>
|
||||
<form method="get" class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Filters</h2>
|
||||
<form hx-get="{% url 'rides:ride_list' %}"
|
||||
hx-target="#rides-grid"
|
||||
hx-push-url="true"
|
||||
hx-trigger="change from:select, keyup[target.name=='search'] delay:500ms from:input"
|
||||
class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">Category</label>
|
||||
<select name="category" class="form-select w-full">
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Search</label>
|
||||
<input type="text"
|
||||
name="search"
|
||||
value="{{ current_filters.search }}"
|
||||
placeholder="Search rides..."
|
||||
class="form-input w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Category</label>
|
||||
<select name="category"
|
||||
class="form-select w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white">
|
||||
<option value="">All Categories</option>
|
||||
<option value="RC">Roller Coaster</option>
|
||||
<option value="DR">Dark Ride</option>
|
||||
<option value="FR">Flat Ride</option>
|
||||
<option value="WR">Water Ride</option>
|
||||
<option value="TR">Transport</option>
|
||||
<option value="OT">Other</option>
|
||||
<option value="RC" {% if current_filters.category == 'RC' %}selected{% endif %}>Roller Coaster</option>
|
||||
<option value="DR" {% if current_filters.category == 'DR' %}selected{% endif %}>Dark Ride</option>
|
||||
<option value="FR" {% if current_filters.category == 'FR' %}selected{% endif %}>Flat Ride</option>
|
||||
<option value="WR" {% if current_filters.category == 'WR' %}selected{% endif %}>Water Ride</option>
|
||||
<option value="TR" {% if current_filters.category == 'TR' %}selected{% endif %}>Transport</option>
|
||||
<option value="OT" {% if current_filters.category == 'OT' %}selected{% endif %}>Other</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">Status</label>
|
||||
<select name="status" class="form-select w-full">
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Status</label>
|
||||
<select name="status"
|
||||
class="form-select w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white">
|
||||
<option value="">All Statuses</option>
|
||||
<option value="OPERATING">Operating</option>
|
||||
<option value="CLOSED_TEMP">Temporarily Closed</option>
|
||||
<option value="CLOSED_PERM">Permanently Closed</option>
|
||||
<option value="UNDER_CONSTRUCTION">Under Construction</option>
|
||||
<option value="DEMOLISHED">Demolished</option>
|
||||
<option value="RELOCATED">Relocated</option>
|
||||
<option value="OPERATING" {% if current_filters.status == 'OPERATING' %}selected{% endif %}>Operating</option>
|
||||
<option value="CLOSED_TEMP" {% if current_filters.status == 'CLOSED_TEMP' %}selected{% endif %}>Temporarily Closed</option>
|
||||
<option value="CLOSED_PERM" {% if current_filters.status == 'CLOSED_PERM' %}selected{% endif %}>Permanently Closed</option>
|
||||
<option value="UNDER_CONSTRUCTION" {% if current_filters.status == 'UNDER_CONSTRUCTION' %}selected{% endif %}>Under Construction</option>
|
||||
<option value="DEMOLISHED" {% if current_filters.status == 'DEMOLISHED' %}selected{% endif %}>Demolished</option>
|
||||
<option value="RELOCATED" {% if current_filters.status == 'RELOCATED' %}selected{% endif %}>Relocated</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-1">Manufacturer</label>
|
||||
<select name="manufacturer" class="form-select w-full">
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Manufacturer</label>
|
||||
<select name="manufacturer"
|
||||
class="form-select w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white">
|
||||
<option value="">All Manufacturers</option>
|
||||
{% for manufacturer in manufacturers %}
|
||||
<option value="{{ manufacturer }}">{{ manufacturer }}</option>
|
||||
<option value="{{ manufacturer }}" {% if current_filters.manufacturer == manufacturer %}selected{% endif %}>{{ manufacturer }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
@@ -50,78 +65,8 @@
|
||||
</div>
|
||||
|
||||
<!-- Rides Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% for ride in rides %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden">
|
||||
{% if ride.photos.exists %}
|
||||
<img src="{{ ride.photos.first.image.url }}"
|
||||
alt="{{ ride.name }}"
|
||||
class="w-full h-48 object-cover">
|
||||
{% else %}
|
||||
<div class="w-full h-48 bg-gray-200 dark:bg-gray-700 flex items-center justify-center">
|
||||
<span class="text-gray-400">No image available</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="p-4">
|
||||
<h3 class="text-xl font-semibold mb-2">
|
||||
<a href="{{ ride.get_absolute_url }}" class="hover:text-blue-500">
|
||||
{{ ride.name }}
|
||||
</a>
|
||||
</h3>
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">
|
||||
at <a href="{{ ride.park.get_absolute_url }}" class="hover:text-blue-500">
|
||||
{{ ride.park.name }}
|
||||
</a>
|
||||
</p>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ ride.get_category_display }}
|
||||
</span>
|
||||
{% if ride.average_rating %}
|
||||
<div class="flex items-center">
|
||||
<span class="text-yellow-400 mr-1">★</span>
|
||||
<span>{{ ride.average_rating|floatformat:1 }}/10</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if ride.category == 'RC' and ride.coaster_stats %}
|
||||
<div class="mt-2 text-sm text-gray-600 dark:text-gray-400">
|
||||
<div>Height: {{ ride.coaster_stats.height_ft }}ft</div>
|
||||
<div>Speed: {{ ride.coaster_stats.speed_mph }}mph</div>
|
||||
<div>Inversions: {{ ride.coaster_stats.inversions }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="col-span-full text-center py-8">
|
||||
<p class="text-gray-500 dark:text-gray-400">No rides found matching your criteria.</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div id="rides-grid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% include 'rides/partials/ride_list.html' %}
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
{% if is_paginated %}
|
||||
<div class="flex justify-center mt-6">
|
||||
<nav class="inline-flex rounded-md shadow">
|
||||
{% if page_obj.has_previous %}
|
||||
<a href="?page={{ page_obj.previous_page_number }}" class="pagination-link">Previous</a>
|
||||
{% endif %}
|
||||
|
||||
{% for num in page_obj.paginator.page_range %}
|
||||
{% if page_obj.number == num %}
|
||||
<span class="pagination-current">{{ num }}</span>
|
||||
{% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %}
|
||||
<a href="?page={{ num }}" class="pagination-link">{{ num }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}" class="pagination-link">Next</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user