mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-23 09:51:08 -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 %}
|
||||
|
||||
Reference in New Issue
Block a user