mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-22 00:31:09 -05:00
series of tests added with built-in django test support
This commit is contained in:
@@ -1,107 +1,141 @@
|
||||
{% extends 'base/base.html' %}
|
||||
{% extends "base/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Ride Manufacturers - ThrillWiki{% endblock %}
|
||||
{% block title %}Manufacturers - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h1 class="text-3xl font-bold text-gray-900 dark:text-white">Ride Manufacturers</h1>
|
||||
<div class="container px-4 mx-auto sm:px-6 lg:px-8">
|
||||
<!-- Header -->
|
||||
<div class="flex flex-col items-start justify-between gap-4 mb-6 sm:flex-row sm:items-center">
|
||||
<h1 class="text-2xl font-bold text-gray-900 lg:text-3xl dark:text-white">Manufacturers</h1>
|
||||
{% if user.is_authenticated %}
|
||||
<a href="{% url 'companies:manufacturer_create' %}"
|
||||
class="transition-transform btn-primary hover:scale-105">
|
||||
<i class="mr-1 fas fa-plus"></i>Add Manufacturer
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Stats -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{{ total_manufacturers }}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Manufacturers</div>
|
||||
<div class="grid grid-cols-1 gap-4 mb-6 sm:grid-cols-3">
|
||||
<div class="p-4 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">Total Manufacturers</dt>
|
||||
<dd class="mt-1 text-3xl font-semibold text-gray-900 dark:text-white">{{ total_manufacturers }}</dd>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{{ total_rides }}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Total Rides</div>
|
||||
<div class="p-4 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">Total Rides</dt>
|
||||
<dd class="mt-1 text-3xl font-semibold text-gray-900 dark:text-white">{{ total_rides }}</dd>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{{ total_roller_coasters }}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Roller Coasters</div>
|
||||
<div class="p-4 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<dt class="text-sm font-medium text-gray-500 dark:text-gray-400">Total Roller Coasters</dt>
|
||||
<dd class="mt-1 text-3xl font-semibold text-gray-900 dark:text-white">{{ total_roller_coasters }}</dd>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filters -->
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-4 mb-6">
|
||||
<form method="get" class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Search</label>
|
||||
<input type="text" name="search" value="{{ request.GET.search }}"
|
||||
class="form-input w-full" placeholder="Search manufacturers...">
|
||||
<!-- Search and Filter -->
|
||||
<div class="p-4 mb-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<form method="get" class="flex flex-col gap-4 sm:flex-row sm:items-end">
|
||||
<div class="flex-1">
|
||||
<label for="search" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">Search</label>
|
||||
<input type="text"
|
||||
name="search"
|
||||
id="search"
|
||||
value="{{ request.GET.search }}"
|
||||
placeholder="Search manufacturers..."
|
||||
class="w-full px-3 py-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1">Country</label>
|
||||
<input type="text" name="country" value="{{ request.GET.country }}"
|
||||
class="form-input w-full" placeholder="Filter by country...">
|
||||
</div>
|
||||
<div class="flex items-end">
|
||||
<button type="submit" class="btn-primary w-full">Apply Filters</button>
|
||||
<div class="flex-1">
|
||||
<label for="country" class="block mb-1 text-sm font-medium text-gray-700 dark:text-gray-300">Country</label>
|
||||
<input type="text"
|
||||
name="country"
|
||||
id="country"
|
||||
value="{{ request.GET.country }}"
|
||||
placeholder="Filter by country..."
|
||||
class="w-full px-3 py-2 border rounded-lg dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
</div>
|
||||
<button type="submit" class="btn-primary">
|
||||
<i class="mr-1 fas fa-search"></i>Search
|
||||
</button>
|
||||
{% if request.GET.search or request.GET.country %}
|
||||
<a href="{% url 'companies:manufacturer_list' %}" class="btn-secondary">
|
||||
<i class="mr-1 fas fa-times"></i>Clear
|
||||
</a>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Manufacturers Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% if manufacturers %}
|
||||
<div class="grid gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{% for manufacturer in manufacturers %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden">
|
||||
<div class="p-4">
|
||||
<h3 class="text-xl font-semibold mb-2">
|
||||
<a href="{% url 'companies:manufacturer_detail' manufacturer.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">
|
||||
{{ manufacturer.name }}
|
||||
</a>
|
||||
</h3>
|
||||
{% if manufacturer.headquarters %}
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">{{ manufacturer.headquarters }}</p>
|
||||
{% endif %}
|
||||
<div class="text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ manufacturer.rides.count }} rides manufactured
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-6 transition-transform bg-white rounded-lg shadow hover:scale-[1.02] dark:bg-gray-800">
|
||||
<h2 class="mb-2 text-xl font-semibold">
|
||||
<a href="{% url 'companies:manufacturer_detail' manufacturer.slug %}"
|
||||
class="text-gray-900 hover:text-blue-600 dark:text-white dark:hover:text-blue-400">
|
||||
{{ manufacturer.name }}
|
||||
</a>
|
||||
</h2>
|
||||
{% if manufacturer.headquarters %}
|
||||
<div class="flex items-center mb-2 text-gray-600 dark:text-gray-400">
|
||||
<i class="mr-2 fas fa-building"></i>
|
||||
{{ manufacturer.headquarters }}
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="col-span-full text-center py-8">
|
||||
<p class="text-gray-500 dark:text-gray-400">No manufacturers found matching your criteria.</p>
|
||||
{% endif %}
|
||||
{% if manufacturer.website %}
|
||||
<div class="flex items-center mb-4 text-gray-600 dark:text-gray-400">
|
||||
<i class="mr-2 fas fa-globe"></i>
|
||||
<a href="{{ manufacturer.website }}"
|
||||
class="text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300"
|
||||
target="_blank" rel="noopener noreferrer">
|
||||
Website
|
||||
<i class="ml-1 text-xs fas fa-external-link-alt"></i>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="flex flex-wrap gap-2">
|
||||
{% if manufacturer.total_rides %}
|
||||
<span class="px-2 py-1 text-sm font-medium text-blue-800 bg-blue-100 rounded-full dark:bg-blue-700 dark:text-blue-50">
|
||||
{{ manufacturer.total_rides }} Rides
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if manufacturer.total_roller_coasters %}
|
||||
<span class="px-2 py-1 text-sm font-medium text-green-800 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-50">
|
||||
{{ manufacturer.total_roller_coasters }} Coasters
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="p-6 text-center bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<p class="text-gray-500 dark:text-gray-400">No manufacturers found.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- 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 }}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}{% if request.GET.country %}&country={{ request.GET.country }}{% endif %}"
|
||||
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 }}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}{% if request.GET.country %}&country={{ request.GET.country }}{% endif %}"
|
||||
class="pagination-link">{{ num }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}{% if request.GET.search %}&search={{ request.GET.search }}{% endif %}{% if request.GET.country %}&country={{ request.GET.country }}{% endif %}"
|
||||
class="pagination-link">Next</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
<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="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-700">
|
||||
Previous
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<span class="px-3 py-2 text-sm font-medium text-gray-700 bg-white border-t border-b border-gray-300 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-300">
|
||||
Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
|
||||
</span>
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}"
|
||||
class="px-3 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md hover:bg-gray-50 dark:bg-gray-800 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-700">
|
||||
Next
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
{
|
||||
id: {{ photo.id }},
|
||||
url: '{{ photo.image.url }}',
|
||||
caption: '{{ photo.caption|default:""|escapejs }}'
|
||||
caption: '{{ photo.caption|default:""|escapejs }}',
|
||||
date_taken: '{{ photo.date_taken|date:"F j, Y g:i A"|default:""|escapejs }}',
|
||||
uploaded_by: '{{ photo.uploaded_by.username|default:""|escapejs }}'
|
||||
}{% if not forloop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
],
|
||||
@@ -90,15 +92,35 @@
|
||||
<i class="text-2xl fas fa-times"></i>
|
||||
</button>
|
||||
|
||||
<!-- Photo -->
|
||||
<img :src="fullscreenPhoto?.url"
|
||||
:alt="fullscreenPhoto?.caption || ''"
|
||||
class="max-h-[90vh] w-auto mx-auto rounded-lg">
|
||||
<!-- Photo Container -->
|
||||
<div class="relative">
|
||||
<img :src="fullscreenPhoto?.url"
|
||||
:alt="fullscreenPhoto?.caption || ''"
|
||||
class="max-h-[90vh] w-auto mx-auto rounded-lg">
|
||||
|
||||
<!-- Caption -->
|
||||
<div x-show="fullscreenPhoto?.caption"
|
||||
class="mt-4 text-center text-white"
|
||||
x-text="fullscreenPhoto?.caption">
|
||||
<!-- Photo Info Overlay -->
|
||||
<div class="absolute bottom-0 left-0 right-0 p-4 text-white bg-black bg-opacity-50 rounded-b-lg">
|
||||
<!-- Caption -->
|
||||
<div x-show="fullscreenPhoto?.caption"
|
||||
class="mb-2 text-lg font-medium"
|
||||
x-text="fullscreenPhoto?.caption">
|
||||
</div>
|
||||
|
||||
<!-- Photo Details -->
|
||||
<div class="flex flex-wrap gap-4 text-sm">
|
||||
<!-- Uploaded By -->
|
||||
<div x-show="fullscreenPhoto?.uploaded_by" class="flex items-center">
|
||||
<i class="mr-2 fas fa-user"></i>
|
||||
<span x-text="fullscreenPhoto?.uploaded_by"></span>
|
||||
</div>
|
||||
|
||||
<!-- Date Taken -->
|
||||
<div x-show="fullscreenPhoto?.date_taken" class="flex items-center">
|
||||
<i class="mr-2 fas fa-calendar"></i>
|
||||
<span x-text="fullscreenPhoto?.date_taken"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Actions -->
|
||||
|
||||
90
templates/parks/area_detail.html
Normal file
90
templates/parks/area_detail.html
Normal file
@@ -0,0 +1,90 @@
|
||||
{% extends "base/base.html" %}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{ area.name }} - {{ area.park.name }} - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container px-4 mx-auto sm:px-6 lg:px-8">
|
||||
<!-- Breadcrumb -->
|
||||
<nav class="flex mb-4 text-sm" aria-label="Breadcrumb">
|
||||
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
||||
<li>
|
||||
<a href="{% url 'parks:park_detail' area.park.slug %}"
|
||||
class="text-blue-600 hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300">
|
||||
{{ area.park.name }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="flex items-center">
|
||||
<i class="mx-2 text-gray-400 fas fa-chevron-right"></i>
|
||||
<span class="text-gray-500 dark:text-gray-400">{{ area.name }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<!-- Area Header -->
|
||||
<div class="p-6 mb-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<h1 class="text-2xl font-bold text-gray-900 lg:text-3xl dark:text-white">{{ area.name }}</h1>
|
||||
{% if user.is_authenticated %}
|
||||
<a href="#" class="transition-transform btn-secondary hover:scale-105">
|
||||
<i class="mr-1 fas fa-pencil-alt"></i>Edit
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if area.description %}
|
||||
<div class="prose dark:prose-invert max-w-none">
|
||||
{{ area.description|linebreaks }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if area.opening_date or area.closing_date %}
|
||||
<div class="mt-4 space-y-2">
|
||||
{% if area.opening_date %}
|
||||
<div class="flex items-center text-gray-600 dark:text-gray-400">
|
||||
<i class="mr-2 fas fa-calendar-plus"></i>
|
||||
<span>Opened: {{ area.opening_date }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if area.closing_date %}
|
||||
<div class="flex items-center text-gray-600 dark:text-gray-400">
|
||||
<i class="mr-2 fas fa-calendar-minus"></i>
|
||||
<span>Closed: {{ area.closing_date }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Rides in this Area -->
|
||||
{% if area.rides.exists %}
|
||||
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<h2 class="mb-4 text-xl font-semibold text-gray-900 dark:text-white">Rides & Attractions</h2>
|
||||
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{% for ride in area.rides.all %}
|
||||
<div class="p-4 transition-colors rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700">
|
||||
<a href="{% url 'parks:rides:ride_detail' area.park.slug ride.slug %}" class="block">
|
||||
<h3 class="mb-1 font-semibold text-gray-900 dark:text-white">{{ ride.name }}</h3>
|
||||
<span class="text-blue-800 bg-blue-100 status-badge dark:bg-blue-700 dark:text-blue-50">
|
||||
{{ ride.get_category_display }}
|
||||
</span>
|
||||
{% if ride.average_rating %}
|
||||
<span class="flex items-center text-yellow-800 bg-yellow-100 status-badge dark:bg-yellow-600 dark:text-yellow-50">
|
||||
<span class="mr-1 text-yellow-500 dark:text-yellow-200">★</span>
|
||||
{{ ride.average_rating|floatformat:1 }}/10
|
||||
</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="p-6 bg-white rounded-lg shadow dark:bg-gray-800">
|
||||
<p class="text-gray-500 dark:text-gray-400">No rides or attractions listed in this area yet.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,5 +1,6 @@
|
||||
{% extends "base/base.html" %}
|
||||
{% load static %}
|
||||
{% load park_tags %}
|
||||
|
||||
{% block title %}{{ park.name }} - ThrillWiki{% endblock %}
|
||||
|
||||
@@ -41,7 +42,7 @@
|
||||
<i class="mr-1 fas fa-star"></i>Add Review
|
||||
</a>
|
||||
{% else %}
|
||||
{% if user.has_reviewed_park(park) %}
|
||||
{% if user|has_reviewed_park:park %}
|
||||
<a href="{% url 'reviews:edit_review' park.slug %}"
|
||||
class="transition-transform btn-secondary hover:scale-105">
|
||||
<i class="mr-1 fas fa-star"></i>Edit Review
|
||||
|
||||
Reference in New Issue
Block a user