mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-21 19:51:09 -05:00
yay
This commit is contained in:
@@ -6,127 +6,110 @@
|
||||
{% block title %}Login - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="max-w-md mx-auto">
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6">
|
||||
<h1 class="text-2xl font-bold mb-6 text-gray-900 dark:text-white">{% trans "Sign In" %}</h1>
|
||||
<div class="flex items-center justify-center min-h-[calc(100vh-16rem)]">
|
||||
<div class="w-full max-w-md">
|
||||
<div class="auth-card">
|
||||
<h1 class="auth-title">{% trans "Welcome Back" %}</h1>
|
||||
|
||||
{% get_providers as socialaccount_providers %}
|
||||
|
||||
{% if socialaccount_providers %}
|
||||
<div class="space-y-3 mb-6">
|
||||
{% for provider in socialaccount_providers %}
|
||||
<a href="{% provider_login_url provider.id process='login' %}"
|
||||
class="w-full flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown="if(event.key === 'Enter' || event.key === ' ') { this.click(); event.preventDefault(); }">
|
||||
{% if provider.id == 'google' %}
|
||||
<img src="{% static 'images/google-icon.svg' %}" alt="Google" class="h-5 w-5 mr-2">
|
||||
{% elif provider.id == 'discord' %}
|
||||
<img src="{% static 'images/discord-icon.svg' %}" alt="Discord" class="h-5 w-5 mr-2">
|
||||
{% endif %}
|
||||
Sign in with {{ provider.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% get_providers as socialaccount_providers %}
|
||||
|
||||
<div class="relative my-6">
|
||||
<div class="absolute inset-0 flex items-center">
|
||||
<div class="w-full border-t border-gray-300 dark:border-gray-600"></div>
|
||||
{% if socialaccount_providers %}
|
||||
<div class="space-y-3">
|
||||
{% for provider in socialaccount_providers %}
|
||||
<a href="{% provider_login_url provider.id process='login' %}"
|
||||
class="btn-social {% if provider.id == 'discord' %}btn-discord{% elif provider.id == 'google' %}btn-google{% endif %}"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown="if(event.key === 'Enter' || event.key === ' ') { this.click(); event.preventDefault(); }">
|
||||
{% if provider.id == 'google' %}
|
||||
<img src="{% static 'images/google-icon.svg' %}" alt="Google" class="w-5 h-5 mr-3">
|
||||
<span>Continue with Google</span>
|
||||
{% elif provider.id == 'discord' %}
|
||||
<img src="{% static 'images/discord-icon.svg' %}" alt="Discord" class="w-5 h-5 mr-3">
|
||||
<span>Continue with Discord</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="relative flex justify-center text-sm">
|
||||
<span class="px-2 bg-white dark:bg-gray-800 text-gray-500">Or continue with</span>
|
||||
|
||||
<div class="auth-divider">
|
||||
<span>Or continue with email</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form class="space-y-4" method="POST" action="{% url 'account_login' %}"
|
||||
onkeydown="if(event.key === 'Enter' && !event.shiftKey) {
|
||||
const activeElement = document.activeElement;
|
||||
if (activeElement.tagName === 'TEXTAREA') {
|
||||
if (!event.shiftKey) {
|
||||
event.preventDefault();
|
||||
this.submit();
|
||||
}
|
||||
} else {
|
||||
event.preventDefault();
|
||||
this.submit();
|
||||
}
|
||||
}">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="bg-red-50 dark:bg-red-900 border-l-4 border-red-400 p-4 mb-4">
|
||||
<div class="text-sm text-red-700 dark:text-red-200">
|
||||
{{ form.non_field_errors }}
|
||||
<form class="space-y-6" method="POST" action="{% url 'account_login' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-error">
|
||||
<div class="text-sm">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<label for="id_login" class="form-label">
|
||||
{% trans "Username or Email" %}
|
||||
</label>
|
||||
<input type="text" name="login" id="id_login" required
|
||||
autocomplete="username email"
|
||||
class="form-input">
|
||||
{% if form.login.errors %}
|
||||
<p class="form-error">{{ form.login.errors }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_password" class="form-label">
|
||||
{% trans "Password" %}
|
||||
</label>
|
||||
<input type="password" name="password" id="id_password" required
|
||||
autocomplete="current-password"
|
||||
class="form-input">
|
||||
{% if form.password.errors %}
|
||||
<p class="form-error">{{ form.password.errors }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<input type="checkbox" name="remember" id="id_remember"
|
||||
class="w-4 h-4 border-gray-300 rounded text-primary focus:ring-primary/50 dark:border-gray-700">
|
||||
<label for="id_remember" class="block ml-2 text-sm text-gray-700 dark:text-gray-300">
|
||||
{% trans "Remember me" %}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="text-sm">
|
||||
<a href="{% url 'account_reset_password' %}"
|
||||
class="font-medium transition-colors text-primary hover:text-primary/80 focus:outline-none focus:underline"
|
||||
onkeydown="if(event.key === 'Enter') { this.click(); }">
|
||||
{% trans "Forgot Password?" %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<label for="id_login" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{% trans "Username or Email" %}
|
||||
</label>
|
||||
<input type="text" name="login" id="id_login" required
|
||||
autocomplete="username email"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
{% if form.login.errors %}
|
||||
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ form.login.errors }}</p>
|
||||
{% if redirect_field_value %}
|
||||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_password" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{% trans "Password" %}
|
||||
</label>
|
||||
<input type="password" name="password" id="id_password" required
|
||||
autocomplete="current-password"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
{% if form.password.errors %}
|
||||
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ form.password.errors }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center">
|
||||
<input type="checkbox" name="remember" id="id_remember"
|
||||
class="h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 rounded">
|
||||
<label for="id_remember" class="ml-2 block text-sm text-gray-900 dark:text-gray-300">
|
||||
{% trans "Remember me" %}
|
||||
</label>
|
||||
<div>
|
||||
<button type="submit" class="w-full btn-primary">
|
||||
<i class="mr-2 fas fa-sign-in-alt"></i>
|
||||
{% trans "Sign In" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="text-sm">
|
||||
<a href="{% url 'account_reset_password' %}"
|
||||
class="font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400 focus:outline-none focus:underline"
|
||||
<div class="mt-6 text-sm text-center">
|
||||
<p class="text-gray-600 dark:text-gray-400">
|
||||
{% trans "Don't have an account?" %}
|
||||
<a href="{% url 'account_signup' %}"
|
||||
class="ml-1 font-medium transition-colors text-primary hover:text-primary/80 focus:outline-none focus:underline"
|
||||
onkeydown="if(event.key === 'Enter') { this.click(); }">
|
||||
{% trans "Forgot Password?" %}
|
||||
{% trans "Sign up" %}
|
||||
</a>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% if redirect_field_value %}
|
||||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<button type="submit"
|
||||
class="w-full inline-flex justify-center items-center px-4 py-3 border border-transparent text-base font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
<i class="fas fa-sign-in-alt mr-2"></i>
|
||||
{% trans "Sign In" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="mt-6 text-center text-sm">
|
||||
<p class="text-gray-600 dark:text-gray-400">
|
||||
{% trans "Don't have an account?" %}
|
||||
<a href="{% url 'account_signup' %}"
|
||||
class="font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400 focus:outline-none focus:underline"
|
||||
onkeydown="if(event.key === 'Enter') { this.click(); }">
|
||||
{% trans "Sign up" %}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,132 +6,133 @@
|
||||
{% block title %}Register - ThrillWiki{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="max-w-md mx-auto">
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6">
|
||||
<h1 class="text-2xl font-bold mb-6 text-gray-900 dark:text-white">{% trans "Sign Up" %}</h1>
|
||||
<div class="flex items-center justify-center min-h-[calc(100vh-16rem)]">
|
||||
<div class="w-full max-w-md">
|
||||
<div class="auth-card">
|
||||
<h1 class="auth-title">{% trans "Create Account" %}</h1>
|
||||
|
||||
{% get_providers as socialaccount_providers %}
|
||||
|
||||
{% if socialaccount_providers %}
|
||||
<div class="space-y-3 mb-6">
|
||||
{% for provider in socialaccount_providers %}
|
||||
<a href="{% provider_login_url provider.id process='signup' %}"
|
||||
class="w-full flex items-center justify-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown="if(event.key === 'Enter' || event.key === ' ') { this.click(); event.preventDefault(); }">
|
||||
{% if provider.id == 'google' %}
|
||||
<img src="{% static 'images/google-icon.svg' %}" alt="Google" class="h-5 w-5 mr-2">
|
||||
{% elif provider.id == 'discord' %}
|
||||
<img src="{% static 'images/discord-icon.svg' %}" alt="Discord" class="h-5 w-5 mr-2">
|
||||
{% endif %}
|
||||
Sign up with {{ provider.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% get_providers as socialaccount_providers %}
|
||||
|
||||
<div class="relative my-6">
|
||||
<div class="absolute inset-0 flex items-center">
|
||||
<div class="w-full border-t border-gray-300 dark:border-gray-600"></div>
|
||||
{% if socialaccount_providers %}
|
||||
<div class="space-y-3">
|
||||
{% for provider in socialaccount_providers %}
|
||||
<a href="{% provider_login_url provider.id process='signup' %}"
|
||||
class="btn-social {% if provider.id == 'discord' %}btn-discord{% elif provider.id == 'google' %}btn-google{% endif %}"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
onkeydown="if(event.key === 'Enter' || event.key === ' ') { this.click(); event.preventDefault(); }">
|
||||
{% if provider.id == 'google' %}
|
||||
<img src="{% static 'images/google-icon.svg' %}" alt="Google" class="w-5 h-5 mr-3">
|
||||
<span>Continue with Google</span>
|
||||
{% elif provider.id == 'discord' %}
|
||||
<img src="{% static 'images/discord-icon.svg' %}" alt="Discord" class="w-5 h-5 mr-3">
|
||||
<span>Continue with Discord</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="relative flex justify-center text-sm">
|
||||
<span class="px-2 bg-white dark:bg-gray-800 text-gray-500">Or continue with</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form class="space-y-4" method="POST" action="{% url 'account_signup' %}"
|
||||
onkeydown="if(event.key === 'Enter' && !event.shiftKey) {
|
||||
const activeElement = document.activeElement;
|
||||
if (activeElement.tagName === 'TEXTAREA') {
|
||||
if (!event.shiftKey) {
|
||||
event.preventDefault();
|
||||
this.submit();
|
||||
}
|
||||
} else {
|
||||
event.preventDefault();
|
||||
this.submit();
|
||||
}
|
||||
}">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="bg-red-50 dark:bg-red-900 border-l-4 border-red-400 p-4 mb-4">
|
||||
<div class="text-sm text-red-700 dark:text-red-200">
|
||||
{{ form.non_field_errors }}
|
||||
</div>
|
||||
|
||||
<div class="auth-divider">
|
||||
<span>Or continue with email</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<label for="id_username" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{% trans "Username" %}
|
||||
</label>
|
||||
<input type="text" name="username" id="id_username" required
|
||||
autocomplete="username"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
{% if form.username.errors %}
|
||||
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ form.username.errors }}</p>
|
||||
<form class="space-y-6" method="POST" action="{% url 'account_signup' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-error">
|
||||
<div class="text-sm">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div>
|
||||
<label for="id_username" class="form-label">
|
||||
{% trans "Username" %}
|
||||
</label>
|
||||
<input type="text" name="username" id="id_username" required
|
||||
autocomplete="username"
|
||||
class="form-input">
|
||||
{% if form.username.errors %}
|
||||
<p class="form-error">{{ form.username.errors }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_email" class="form-label">
|
||||
{% trans "Email" %}
|
||||
</label>
|
||||
<input type="email" name="email" id="id_email" required
|
||||
autocomplete="email"
|
||||
class="form-input">
|
||||
{% if form.email.errors %}
|
||||
<p class="form-error">{{ form.email.errors }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_password1" class="form-label">
|
||||
{% trans "Password" %}
|
||||
</label>
|
||||
<input type="password" name="password1" id="id_password1" required
|
||||
autocomplete="new-password"
|
||||
class="form-input"
|
||||
oninput="validatePassword(this.value)">
|
||||
{% if form.password1.errors %}
|
||||
<p class="form-error">{{ form.password1.errors }}</p>
|
||||
{% endif %}
|
||||
<div class="mt-3 password-requirements">
|
||||
<ul id="passwordRequirements">
|
||||
<li class="invalid" id="req-length">
|
||||
<i class="text-xs fas fa-circle"></i>
|
||||
<span>Must be at least 8 characters long</span>
|
||||
</li>
|
||||
<li class="invalid" id="req-similar">
|
||||
<i class="text-xs fas fa-circle"></i>
|
||||
<span>Can't be too similar to your personal information</span>
|
||||
</li>
|
||||
<li class="invalid" id="req-common">
|
||||
<i class="text-xs fas fa-circle"></i>
|
||||
<span>Can't be a commonly used password</span>
|
||||
</li>
|
||||
<li class="invalid" id="req-numeric">
|
||||
<i class="text-xs fas fa-circle"></i>
|
||||
<span>Can't be entirely numeric</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_email" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{% trans "Email" %}
|
||||
</label>
|
||||
<input type="email" name="email" id="id_email" required
|
||||
autocomplete="email"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
{% if form.email.errors %}
|
||||
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ form.email.errors }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_password1" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
{% trans "Password" %}
|
||||
</label>
|
||||
<input type="password" name="password1" id="id_password1" required
|
||||
autocomplete="new-password"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
{% if form.password1.errors %}
|
||||
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ form.password1.errors }}</p>
|
||||
{% endif %}
|
||||
{% if form.password1.help_text %}
|
||||
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">{{ form.password1.help_text }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="id_password2" class="block text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
<label for="id_password2" class="form-label">
|
||||
{% trans "Confirm Password" %}
|
||||
</label>
|
||||
<input type="password" name="password2" id="id_password2" required
|
||||
autocomplete="new-password"
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:text-white">
|
||||
class="form-input"
|
||||
oninput="validatePasswordMatch()">
|
||||
{% if form.password2.errors %}
|
||||
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ form.password2.errors }}</p>
|
||||
<p class="form-error">{{ form.password2.errors }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if redirect_field_value %}
|
||||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}">
|
||||
{% endif %}
|
||||
|
||||
<div class="mt-6">
|
||||
<button type="submit"
|
||||
class="w-full inline-flex justify-center items-center px-4 py-3 border border-transparent text-base font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
|
||||
<i class="fas fa-user-plus mr-2"></i>
|
||||
<div>
|
||||
<button type="submit" class="w-full btn-primary">
|
||||
<i class="mr-2 fas fa-user-plus"></i>
|
||||
{% trans "Create Account" %}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="mt-6 text-center text-sm">
|
||||
<div class="mt-6 text-sm text-center">
|
||||
<p class="text-gray-600 dark:text-gray-400">
|
||||
{% trans "Already have an account?" %}
|
||||
<a href="{% url 'account_login' %}"
|
||||
class="font-medium text-blue-600 hover:text-blue-500 dark:text-blue-400 focus:outline-none focus:underline"
|
||||
class="ml-1 font-medium transition-colors text-primary hover:text-primary/80 focus:outline-none focus:underline"
|
||||
onkeydown="if(event.key === 'Enter') { this.click(); }">
|
||||
{% trans "Sign in" %}
|
||||
</a>
|
||||
@@ -139,4 +140,69 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function validatePassword(password) {
|
||||
// Length requirement
|
||||
const lengthReq = document.getElementById('req-length');
|
||||
if (password.length >= 8) {
|
||||
lengthReq.classList.remove('invalid');
|
||||
lengthReq.classList.add('valid');
|
||||
lengthReq.querySelector('i').classList.remove('fa-circle');
|
||||
lengthReq.querySelector('i').classList.add('fa-check');
|
||||
} else {
|
||||
lengthReq.classList.remove('valid');
|
||||
lengthReq.classList.add('invalid');
|
||||
lengthReq.querySelector('i').classList.remove('fa-check');
|
||||
lengthReq.querySelector('i').classList.add('fa-circle');
|
||||
}
|
||||
|
||||
// Numeric requirement
|
||||
const numericReq = document.getElementById('req-numeric');
|
||||
if (!/^\d+$/.test(password)) {
|
||||
numericReq.classList.remove('invalid');
|
||||
numericReq.classList.add('valid');
|
||||
numericReq.querySelector('i').classList.remove('fa-circle');
|
||||
numericReq.querySelector('i').classList.add('fa-check');
|
||||
} else {
|
||||
numericReq.classList.remove('valid');
|
||||
numericReq.classList.add('invalid');
|
||||
numericReq.querySelector('i').classList.remove('fa-check');
|
||||
numericReq.querySelector('i').classList.add('fa-circle');
|
||||
}
|
||||
|
||||
// Common password check (basic)
|
||||
const commonReq = document.getElementById('req-common');
|
||||
const commonPasswords = ['password', '12345678', 'qwerty', 'letmein'];
|
||||
if (!commonPasswords.includes(password.toLowerCase())) {
|
||||
commonReq.classList.remove('invalid');
|
||||
commonReq.classList.add('valid');
|
||||
commonReq.querySelector('i').classList.remove('fa-circle');
|
||||
commonReq.querySelector('i').classList.add('fa-check');
|
||||
} else {
|
||||
commonReq.classList.remove('valid');
|
||||
commonReq.classList.add('invalid');
|
||||
commonReq.querySelector('i').classList.remove('fa-check');
|
||||
commonReq.querySelector('i').classList.add('fa-circle');
|
||||
}
|
||||
}
|
||||
|
||||
function validatePasswordMatch() {
|
||||
const password1 = document.getElementById('id_password1').value;
|
||||
const password2 = document.getElementById('id_password2').value;
|
||||
const password2Input = document.getElementById('id_password2');
|
||||
|
||||
if (password2.length > 0) {
|
||||
if (password1 === password2) {
|
||||
password2Input.classList.remove('border-red-500');
|
||||
password2Input.classList.add('border-green-500');
|
||||
} else {
|
||||
password2Input.classList.remove('border-green-500');
|
||||
password2Input.classList.add('border-red-500');
|
||||
}
|
||||
} else {
|
||||
password2Input.classList.remove('border-green-500', 'border-red-500');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,141 +1,225 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" x-data="{ darkMode: localStorage.getItem('darkMode') === 'true' }" :class="{ 'dark': darkMode }">
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}ThrillWiki{% endblock %}</title>
|
||||
|
||||
<!-- Tailwind CSS -->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<!-- Google Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
|
||||
<!-- Prevent flash of wrong theme -->
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: 'class',
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: '#2563eb',
|
||||
secondary: '#4b5563'
|
||||
}
|
||||
}
|
||||
}
|
||||
// Immediately remove 'no-js' class and add initial theme class
|
||||
document.documentElement.classList.remove('no-js');
|
||||
if (localStorage.theme === 'dark' || (!localStorage.theme && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||
document.documentElement.classList.add('dark');
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- AlpineJS -->
|
||||
<script defer src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<!-- HTMX -->
|
||||
<script src="https://unpkg.com/htmx.org@1.9.6"></script>
|
||||
|
||||
<!-- Custom CSS -->
|
||||
<link rel="stylesheet" href="{% static 'css/styles.css' %}">
|
||||
<!-- Tailwind CSS -->
|
||||
<link href="{% static 'css/tailwind.css' %}" rel="stylesheet">
|
||||
|
||||
<!-- Font Awesome -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
||||
|
||||
{% block extra_head %}{% endblock %}
|
||||
|
||||
<!-- Theme Management -->
|
||||
<script>
|
||||
// Theme management
|
||||
const themeManager = {
|
||||
init() {
|
||||
// Set up toggle button when DOM is loaded
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const toggleBtn = document.getElementById('theme-toggle');
|
||||
if (toggleBtn) {
|
||||
toggleBtn.addEventListener('click', () => {
|
||||
this.toggleTheme();
|
||||
});
|
||||
}
|
||||
|
||||
// Watch for system theme changes
|
||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
|
||||
if (!localStorage.theme) {
|
||||
this.setTheme(e.matches ? 'dark' : 'light');
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
setTheme(theme) {
|
||||
// Force a repaint by temporarily adding a class
|
||||
document.documentElement.classList.add('theme-transitioning');
|
||||
|
||||
if (theme === 'dark') {
|
||||
document.documentElement.classList.add('dark');
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark');
|
||||
}
|
||||
|
||||
localStorage.theme = theme;
|
||||
|
||||
// Remove the transition class after a short delay
|
||||
setTimeout(() => {
|
||||
document.documentElement.classList.remove('theme-transitioning');
|
||||
}, 100);
|
||||
},
|
||||
|
||||
toggleTheme() {
|
||||
const isDark = document.documentElement.classList.contains('dark');
|
||||
this.setTheme(isDark ? 'light' : 'dark');
|
||||
}
|
||||
};
|
||||
|
||||
// Initialize theme management
|
||||
themeManager.init();
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Prevent flash of wrong theme */
|
||||
.no-js {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* Smooth theme transitions */
|
||||
:root {
|
||||
--theme-transition-duration: 200ms;
|
||||
}
|
||||
|
||||
.theme-transitioning * {
|
||||
transition: none !important;
|
||||
}
|
||||
|
||||
body {
|
||||
transition: background-color var(--theme-transition-duration) ease-in-out,
|
||||
color var(--theme-transition-duration) ease-in-out;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="bg-gray-100 dark:bg-gray-900 min-h-screen flex flex-col" x-data="{ mobileMenuOpen: false, userMenuOpen: false }">
|
||||
<body class="flex flex-col min-h-screen text-gray-900 bg-gradient-to-br from-white via-blue-50 to-indigo-50 dark:from-gray-950 dark:via-indigo-950 dark:to-purple-950 dark:text-white">
|
||||
<!-- Header -->
|
||||
<header class="bg-white dark:bg-gray-800 shadow-sm">
|
||||
<nav class="container mx-auto px-4 py-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<header class="border-b shadow-lg bg-white/90 dark:bg-gray-800/90 backdrop-blur-lg border-gray-200/50 dark:border-gray-700/50">
|
||||
<nav class="container px-6 py-4 mx-auto">
|
||||
<div class="flex items-center justify-between">
|
||||
<!-- Logo -->
|
||||
<div class="flex items-center">
|
||||
<a href="{% url 'home' %}" class="text-xl font-bold text-blue-600 dark:text-blue-400">ThrillWiki</a>
|
||||
<a href="{% url 'home' %}" class="px-3 text-2xl font-bold text-transparent transition-transform bg-gradient-to-r from-primary to-secondary bg-clip-text hover:scale-105">
|
||||
ThrillWiki
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Desktop Navigation -->
|
||||
<div class="hidden md:flex items-center space-x-4">
|
||||
<a href="{% url 'parks:park_list' %}" class="nav-link">Parks</a>
|
||||
<a href="{% url 'rides:ride_list' %}" class="nav-link">Rides</a>
|
||||
<div class="items-center hidden space-x-8 md:flex">
|
||||
<a href="{% url 'parks:park_list' %}" class="nav-link group">
|
||||
<i class="fas fa-map-marker-alt"></i>
|
||||
<span>Parks</span>
|
||||
</a>
|
||||
<a href="{% url 'rides:ride_list' %}" class="nav-link group">
|
||||
<i class="fas fa-rocket"></i>
|
||||
<span>Rides</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Search Bar -->
|
||||
<div class="hidden md:flex flex-1 max-w-md mx-4">
|
||||
<div class="flex-1 hidden max-w-md mx-8 md:flex">
|
||||
<form action="{% url 'search' %}" method="get" class="w-full">
|
||||
<div class="relative">
|
||||
<input type="text" name="q" placeholder="Search parks and rides..."
|
||||
class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600
|
||||
bg-white dark:bg-gray-700 text-gray-900 dark:text-white">
|
||||
class="w-full px-4 py-2 text-gray-900 transition-all border border-gray-200 rounded-full dark:border-gray-700 bg-white/70 dark:bg-gray-800/70 backdrop-blur-sm dark:text-white focus:ring-2 focus:ring-primary/50 focus:border-primary">
|
||||
<button type="submit" class="absolute right-3 top-2.5">
|
||||
<i class="fas fa-search text-gray-400"></i>
|
||||
<i class="text-gray-400 transition-colors fas fa-search hover:text-primary"></i>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Right Side Menu -->
|
||||
<div class="flex items-center space-x-4">
|
||||
<div class="flex items-center space-x-6">
|
||||
<!-- Theme Toggle -->
|
||||
<button @click="darkMode = !darkMode; localStorage.setItem('darkMode', darkMode)"
|
||||
class="p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<i class="fas" :class="darkMode ? 'fa-sun' : 'fa-moon'"></i>
|
||||
<button id="theme-toggle" class="p-2.5 rounded-lg bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-300 hover:bg-primary/10 dark:hover:bg-primary/20 transition-all shadow-sm border border-gray-200/50 dark:border-gray-600/50">
|
||||
<i class="hidden text-lg fas fa-sun dark:inline"></i>
|
||||
<i class="text-lg fas fa-moon dark:hidden"></i>
|
||||
</button>
|
||||
|
||||
<!-- User Menu -->
|
||||
{% if user.is_authenticated %}
|
||||
<div class="relative" x-data="{ open: false }">
|
||||
<button @click="open = !open" class="flex items-center space-x-2">
|
||||
<div class="relative">
|
||||
<button id="userMenuBtn" class="flex items-center space-x-2 transition-transform hover:scale-105">
|
||||
{% if user.profile.avatar %}
|
||||
<img src="{{ user.profile.avatar.url }}" alt="{{ user.username }}"
|
||||
class="h-8 w-8 rounded-full">
|
||||
class="w-8 h-8 rounded-full ring-2 ring-primary/20">
|
||||
{% else %}
|
||||
<div class="h-8 w-8 rounded-full bg-blue-500 flex items-center justify-center text-white">
|
||||
<div class="flex items-center justify-center w-8 h-8 text-white rounded-full bg-gradient-to-br from-primary to-secondary">
|
||||
{{ user.username.0|upper }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</button>
|
||||
|
||||
<!-- Dropdown Menu -->
|
||||
<div x-show="open" @click.away="open = false"
|
||||
class="absolute right-0 mt-2 w-48 rounded-md shadow-lg bg-white dark:bg-gray-800 ring-1 ring-black ring-opacity-5">
|
||||
<div id="userDropdown" class="dropdown-menu">
|
||||
<div class="py-1">
|
||||
<a href="{% url 'user_profile' user.username %}"
|
||||
class="menu-item">Profile</a>
|
||||
<a href="{% url 'settings' %}"
|
||||
class="menu-item">Settings</a>
|
||||
<a href="{% url 'user_profile' user.username %}" class="menu-item">
|
||||
<i class="w-5 fas fa-user"></i>
|
||||
<span>Profile</span>
|
||||
</a>
|
||||
<a href="{% url 'settings' %}" class="menu-item">
|
||||
<i class="w-5 fas fa-cog"></i>
|
||||
<span>Settings</span>
|
||||
</a>
|
||||
{% if user.is_staff or user.is_superuser %}
|
||||
<a href="{% url 'admin:index' %}"
|
||||
class="menu-item">Admin</a>
|
||||
<a href="{% url 'admin:index' %}" class="menu-item">
|
||||
<i class="w-5 fas fa-shield-alt"></i>
|
||||
<span>Admin</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
<form method="post" action="{% url 'account_logout' %}">
|
||||
{% csrf_token %}
|
||||
<button type="submit" class="menu-item w-full text-left">
|
||||
Logout
|
||||
<button type="submit" class="w-full menu-item">
|
||||
<i class="w-5 fas fa-sign-out-alt"></i>
|
||||
<span>Logout</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="flex space-x-2">
|
||||
<div class="flex space-x-3">
|
||||
<a href="{% url 'account_login' %}" class="btn-secondary">
|
||||
<i class="fas fa-sign-in-alt mr-2"></i>
|
||||
<i class="mr-2 fas fa-sign-in-alt"></i>
|
||||
Login
|
||||
</a>
|
||||
<a href="{% url 'account_signup' %}" class="btn-primary">
|
||||
<i class="fas fa-user-plus mr-2"></i>
|
||||
<i class="mr-2 fas fa-user-plus"></i>
|
||||
Register
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Mobile Menu Button -->
|
||||
<button @click="mobileMenuOpen = !mobileMenuOpen"
|
||||
class="md:hidden p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-700">
|
||||
<button id="mobileMenuBtn" class="p-2 text-gray-500 rounded-lg md:hidden hover:bg-gray-100 dark:hover:bg-gray-700 dark:text-gray-400">
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mobile Menu -->
|
||||
<div x-show="mobileMenuOpen" @click.away="mobileMenuOpen = false"
|
||||
class="md:hidden mt-4 py-2 bg-white dark:bg-gray-800">
|
||||
<a href="{% url 'parks:park_list' %}" class="mobile-nav-link">Parks</a>
|
||||
<a href="{% url 'rides:ride_list' %}" class="mobile-nav-link">Rides</a>
|
||||
<div id="mobileMenu" class="hidden py-2 mt-4 md:hidden bg-white/90 dark:bg-gray-800/90 backdrop-blur-lg rounded-xl">
|
||||
<a href="{% url 'parks:park_list' %}" class="mobile-nav-link">
|
||||
<i class="w-5 fas fa-map-marker-alt"></i>
|
||||
<span>Parks</span>
|
||||
</a>
|
||||
<a href="{% url 'rides:ride_list' %}" class="mobile-nav-link">
|
||||
<i class="w-5 fas fa-rocket"></i>
|
||||
<span>Rides</span>
|
||||
</a>
|
||||
<form action="{% url 'search' %}" method="get" class="px-4 py-2">
|
||||
<input type="text" name="q" placeholder="Search parks and rides..."
|
||||
class="w-full px-4 py-2 rounded-lg border border-gray-300 dark:border-gray-600
|
||||
bg-white dark:bg-gray-700 text-gray-900 dark:text-white">
|
||||
class="w-full px-4 py-2 text-gray-900 border border-gray-200 rounded-full dark:border-gray-700 bg-white/70 dark:bg-gray-800/70 backdrop-blur-sm dark:text-white">
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -143,7 +227,7 @@
|
||||
|
||||
<!-- Flash Messages -->
|
||||
{% if messages %}
|
||||
<div class="container mx-auto px-4 mt-4">
|
||||
<div class="container px-6 mx-auto mt-4">
|
||||
{% for message in messages %}
|
||||
<div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">
|
||||
{{ message }}
|
||||
@@ -153,20 +237,20 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Main Content -->
|
||||
<main class="flex-grow container mx-auto px-4 py-8">
|
||||
<main class="container flex-grow px-6 py-8 mx-auto">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer class="bg-white dark:bg-gray-800 mt-auto">
|
||||
<div class="container mx-auto px-4 py-6">
|
||||
<div class="flex justify-between items-center">
|
||||
<footer class="mt-auto border-t bg-white/90 dark:bg-gray-800/90 backdrop-blur-lg border-gray-200/50 dark:border-gray-700/50">
|
||||
<div class="container px-6 py-6 mx-auto">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="text-gray-600 dark:text-gray-400">
|
||||
<p>© {% now "Y" %} ThrillWiki. All rights reserved.</p>
|
||||
</div>
|
||||
<div class="space-x-4">
|
||||
<a href="{% url 'terms' %}" class="text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">Terms</a>
|
||||
<a href="{% url 'privacy' %}" class="text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white">Privacy</a>
|
||||
<a href="{% url 'terms' %}" class="text-gray-600 transition-colors hover:text-primary dark:text-gray-400 dark:hover:text-primary">Terms</a>
|
||||
<a href="{% url 'privacy' %}" class="text-gray-600 transition-colors hover:text-primary dark:text-gray-400 dark:hover:text-primary">Privacy</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -174,6 +258,42 @@
|
||||
|
||||
<!-- Custom JavaScript -->
|
||||
<script src="{% static 'js/main.js' %}"></script>
|
||||
<script>
|
||||
// Mobile menu toggle
|
||||
const mobileMenuBtn = document.getElementById('mobileMenuBtn');
|
||||
const mobileMenu = document.getElementById('mobileMenu');
|
||||
|
||||
if (mobileMenuBtn && mobileMenu) {
|
||||
mobileMenuBtn.addEventListener('click', () => {
|
||||
mobileMenu.classList.toggle('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
// User dropdown toggle
|
||||
const userMenuBtn = document.getElementById('userMenuBtn');
|
||||
const userDropdown = document.getElementById('userDropdown');
|
||||
|
||||
if (userMenuBtn && userDropdown) {
|
||||
userMenuBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
userDropdown.classList.toggle('active');
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!userMenuBtn.contains(e.target) && !userDropdown.contains(e.target)) {
|
||||
userDropdown.classList.remove('active');
|
||||
}
|
||||
});
|
||||
|
||||
// Close dropdown when pressing escape
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape') {
|
||||
userDropdown.classList.remove('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% block extra_scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
{% block content %}
|
||||
<div class="container mx-auto px-4">
|
||||
<!-- Park Header -->
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 mb-6">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 p-6 mb-6">
|
||||
<div class="flex flex-col md:flex-row justify-between items-start md:items-center">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-2">{{ park.name }}</h1>
|
||||
<p class="text-gray-600 dark:text-gray-400">
|
||||
<p class="text-gray-600 dark:text-gray-300">
|
||||
<i class="fas fa-map-marker-alt mr-2"></i>{{ park.location }}
|
||||
</p>
|
||||
</div>
|
||||
@@ -36,8 +36,8 @@
|
||||
{{ park.get_status_display }}
|
||||
</span>
|
||||
{% if park.average_rating %}
|
||||
<span class="status-badge bg-yellow-100 text-yellow-800">
|
||||
<i class="fas fa-star text-yellow-500 mr-1"></i>
|
||||
<span class="status-badge bg-yellow-100 text-yellow-800 dark:bg-yellow-400/30 dark:text-yellow-200 dark:ring-1 dark:ring-yellow-400/30">
|
||||
<i class="fas fa-star text-yellow-500 dark:text-yellow-300 mr-1"></i>
|
||||
{{ park.average_rating|floatformat:1 }}/10
|
||||
</span>
|
||||
{% endif %}
|
||||
@@ -46,27 +46,27 @@
|
||||
|
||||
<!-- Park 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="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 text-center transform transition-transform hover:-translate-y-1">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{{ rides.count }}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Total Attractions</div>
|
||||
<div class="text-gray-600 dark:text-gray-300 mt-1">Total Attractions</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 text-center transform transition-transform hover:-translate-y-1">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{% with roller_coasters=rides|dictsortreversed:"category"|slice:":RC" %}
|
||||
{{ roller_coasters|length }}
|
||||
{% endwith %}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Roller Coasters</div>
|
||||
<div class="text-gray-600 dark:text-gray-300 mt-1">Roller Coasters</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 text-center">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 text-center transform transition-transform hover:-translate-y-1">
|
||||
<div class="text-3xl font-bold text-blue-600 dark:text-blue-400">
|
||||
{{ areas.count }}
|
||||
</div>
|
||||
<div class="text-gray-600 dark:text-gray-400 mt-1">Areas</div>
|
||||
<div class="text-gray-600 dark:text-gray-300 mt-1">Areas</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -75,9 +75,9 @@
|
||||
<!-- Left Column - Description and Areas -->
|
||||
<div class="lg:col-span-2">
|
||||
{% if park.description %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 mb-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">About</h2>
|
||||
<div class="prose dark:prose-invert max-w-none">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 mb-6">
|
||||
<h2 class="text-2xl font-bold mb-4 text-gray-900 dark:text-white">About</h2>
|
||||
<div class="text-gray-700 dark:text-gray-300">
|
||||
{{ park.description|linebreaks }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,14 +85,14 @@
|
||||
|
||||
<!-- Park Areas -->
|
||||
{% if areas %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 mb-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Areas</h2>
|
||||
<div class="space-y-4">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 mb-6">
|
||||
<h2 class="text-2xl font-bold mb-4 text-gray-900 dark:text-white">Areas</h2>
|
||||
<div class="grid gap-4">
|
||||
{% for area in areas %}
|
||||
<div class="border-b border-gray-200 dark:border-gray-700 last:border-0 pb-4 last:pb-0">
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-2">{{ area.name }}</h3>
|
||||
{% if area.description %}
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">
|
||||
<p class="text-gray-600 dark:text-gray-300 mb-2">
|
||||
{{ area.description }}
|
||||
</p>
|
||||
{% endif %}
|
||||
@@ -106,30 +106,29 @@
|
||||
{% endif %}
|
||||
|
||||
<!-- Rides List -->
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Attractions</h2>
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6">
|
||||
<h2 class="text-2xl font-bold mb-4 text-gray-900 dark:text-white">Attractions</h2>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
{% for ride in rides %}
|
||||
<div class="border border-gray-200 dark:border-gray-700 rounded-lg p-4">
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<h3 class="text-lg font-semibold mb-2">
|
||||
<a href="{% url 'rides:ride_detail' park.slug ride.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">
|
||||
class="text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300">
|
||||
{{ ride.name }}
|
||||
</a>
|
||||
</h3>
|
||||
<div class="flex flex-wrap gap-2 mb-2">
|
||||
<span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800">
|
||||
<span class="status-badge bg-blue-100 text-blue-800 dark:bg-blue-400/30 dark:text-blue-200 dark:ring-1 dark:ring-blue-400/30">
|
||||
{{ ride.get_category_display }}
|
||||
</span>
|
||||
<span class="px-2 py-1 text-xs rounded-full
|
||||
{% if ride.status == 'OPERATING' %}bg-green-100 text-green-800
|
||||
{% elif ride.status == 'CLOSED_TEMP' or ride.status == 'CLOSED_PERM' %}bg-red-100 text-red-800
|
||||
{% else %}bg-gray-100 text-gray-800{% endif %}">
|
||||
<span class="status-badge {% if ride.status == 'OPERATING' %}status-operating
|
||||
{% elif ride.status == 'CLOSED_TEMP' or ride.status == 'CLOSED_PERM' %}status-closed
|
||||
{% else %}status-construction{% endif %}">
|
||||
{{ ride.get_status_display }}
|
||||
</span>
|
||||
</div>
|
||||
{% if ride.coaster_stats %}
|
||||
<div class="text-sm text-gray-600 dark:text-gray-400">
|
||||
<div class="text-sm text-gray-600 dark:text-gray-400 space-y-1">
|
||||
{% if ride.coaster_stats.height_ft %}
|
||||
<div>Height: {{ ride.coaster_stats.height_ft }}ft</div>
|
||||
{% endif %}
|
||||
@@ -150,50 +149,82 @@
|
||||
|
||||
<!-- Right Column - Quick Facts -->
|
||||
<div>
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6 mb-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Quick Facts</h2>
|
||||
<dl class="space-y-4">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6 mb-6">
|
||||
<h2 class="text-2xl font-bold mb-4 text-gray-900 dark:text-white">Quick Facts</h2>
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-1 gap-4">
|
||||
{% if park.owner %}
|
||||
<div>
|
||||
<dt class="text-gray-500 dark:text-gray-400">Owner/Operator</dt>
|
||||
<dd>
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<dt class="flex items-center text-gray-600 dark:text-gray-300 mb-1">
|
||||
<i class="fas fa-building text-blue-500 dark:text-blue-400 w-5"></i>
|
||||
<span class="ml-2">Operator</span>
|
||||
</dt>
|
||||
<dd class="text-gray-900 dark:text-white font-medium">
|
||||
<a href="{% url 'companies:company_detail' park.owner.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">
|
||||
class="text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300">
|
||||
{{ park.owner.name }}
|
||||
</a>
|
||||
</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<dt class="flex items-center text-gray-600 dark:text-gray-300 mb-1">
|
||||
<i class="fas fa-globe text-blue-500 dark:text-blue-400 w-5"></i>
|
||||
<span class="ml-2">Country</span>
|
||||
</dt>
|
||||
<dd class="text-gray-900 dark:text-white font-medium">
|
||||
{{ park.get_country_name }}
|
||||
</dd>
|
||||
</div>
|
||||
{% if park.opening_date %}
|
||||
<div>
|
||||
<dt class="text-gray-500 dark:text-gray-400">Opening Date</dt>
|
||||
<dd class="text-gray-900 dark:text-white">{{ park.opening_date }}</dd>
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<dt class="flex items-center text-gray-600 dark:text-gray-300 mb-1">
|
||||
<i class="fas fa-calendar-alt text-blue-500 dark:text-blue-400 w-5"></i>
|
||||
<span class="ml-2">Opening Date</span>
|
||||
</dt>
|
||||
<dd class="text-gray-900 dark:text-white font-medium">
|
||||
{{ park.opening_date }}
|
||||
</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if park.closing_date %}
|
||||
<div>
|
||||
<dt class="text-gray-500 dark:text-gray-400">Closing Date</dt>
|
||||
<dd class="text-gray-900 dark:text-white">{{ park.closing_date }}</dd>
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<dt class="flex items-center text-gray-600 dark:text-gray-300 mb-1">
|
||||
<i class="fas fa-calendar-times text-blue-500 dark:text-blue-400 w-5"></i>
|
||||
<span class="ml-2">Closing Date</span>
|
||||
</dt>
|
||||
<dd class="text-gray-900 dark:text-white font-medium">
|
||||
{{ park.closing_date }}
|
||||
</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if park.operating_season %}
|
||||
<div>
|
||||
<dt class="text-gray-500 dark:text-gray-400">Operating Season</dt>
|
||||
<dd class="text-gray-900 dark:text-white">{{ park.operating_season }}</dd>
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<dt class="flex items-center text-gray-600 dark:text-gray-300 mb-1">
|
||||
<i class="fas fa-clock text-blue-500 dark:text-blue-400 w-5"></i>
|
||||
<span class="ml-2">Operating Season</span>
|
||||
</dt>
|
||||
<dd class="text-gray-900 dark:text-white font-medium">
|
||||
{{ park.operating_season }}
|
||||
</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if park.size_acres %}
|
||||
<div>
|
||||
<dt class="text-gray-500 dark:text-gray-400">Size</dt>
|
||||
<dd class="text-gray-900 dark:text-white">{{ park.size_acres }} acres</dd>
|
||||
<div class="bg-gray-50 dark:bg-gray-700/50 rounded-lg p-4 transform transition-transform hover:-translate-y-1">
|
||||
<dt class="flex items-center text-gray-600 dark:text-gray-300 mb-1">
|
||||
<i class="fas fa-ruler-combined text-blue-500 dark:text-blue-400 w-5"></i>
|
||||
<span class="ml-2">Size</span>
|
||||
</dt>
|
||||
<dd class="text-gray-900 dark:text-white font-medium">
|
||||
{{ park.size_acres }} acres
|
||||
</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if park.photos.exists %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Photos</h2>
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-lg p-6">
|
||||
<h2 class="text-2xl font-bold mb-4 text-gray-900 dark:text-white">Photos</h2>
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
{% for photo in park.photos.all %}
|
||||
<div class="aspect-w-16 aspect-h-9">
|
||||
|
||||
@@ -12,114 +12,47 @@
|
||||
<!-- Filters -->
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg p-4 mb-6">
|
||||
<h2 class="text-xl font-semibold mb-4 text-gray-900 dark:text-white">Filters</h2>
|
||||
<form method="get" class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<form hx-get="{% url 'parks:park_list' %}"
|
||||
hx-target="#parks-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-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="{{ current_filters.search }}"
|
||||
placeholder="Search parks..."
|
||||
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">Location</label>
|
||||
<select name="location" class="form-select w-full">
|
||||
<select name="location"
|
||||
class="form-select w-full rounded-lg border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:text-white">
|
||||
<option value="">All Locations</option>
|
||||
{% for location in locations %}
|
||||
<option value="{{ location }}" {% if location == selected_location %}selected{% endif %}>
|
||||
{{ location }}
|
||||
</option>
|
||||
<option value="{{ location }}" {% if current_filters.location == location %}selected{% endif %}>{{ location }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<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">
|
||||
<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="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>
|
||||
</select>
|
||||
</div>
|
||||
<div class="md:col-span-2">
|
||||
<button type="submit" class="btn-primary w-full">Apply Filters</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Parks Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% for park in parks %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden">
|
||||
{% if park.photos.exists %}
|
||||
<img src="{{ park.photos.first.image.url }}"
|
||||
alt="{{ park.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="{% url 'parks:park_detail' park.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">
|
||||
{{ park.name }}
|
||||
</a>
|
||||
</h3>
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">{{ park.location }}</p>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ park.rides.count }} attractions
|
||||
</span>
|
||||
{% if park.average_rating %}
|
||||
<div class="flex items-center">
|
||||
<span class="text-yellow-400 mr-1">★</span>
|
||||
<span class="text-gray-600 dark:text-gray-400">
|
||||
{{ park.average_rating|floatformat:1 }}/10
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if park.status != 'OPERATING' %}
|
||||
<div class="mt-2">
|
||||
<span class="px-2 py-1 text-xs rounded-full
|
||||
{% if park.status == 'CLOSED_TEMP' %}bg-yellow-100 text-yellow-800
|
||||
{% elif park.status == 'CLOSED_PERM' %}bg-red-100 text-red-800
|
||||
{% elif park.status == 'UNDER_CONSTRUCTION' %}bg-blue-100 text-blue-800
|
||||
{% else %}bg-gray-100 text-gray-800{% endif %}">
|
||||
{{ park.get_status_display }}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="col-span-full text-center py-8">
|
||||
<p class="text-gray-500 dark:text-gray-400">No parks found matching your criteria.</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div id="parks-grid" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% include 'parks/partials/park_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 }}{% if request.GET.location %}&location={{ request.GET.location }}{% endif %}{% if request.GET.status %}&status={{ request.GET.status }}{% 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.location %}&location={{ request.GET.location }}{% endif %}{% if request.GET.status %}&status={{ request.GET.status }}{% endif %}"
|
||||
class="pagination-link">{{ num }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if page_obj.has_next %}
|
||||
<a href="?page={{ page_obj.next_page_number }}{% if request.GET.location %}&location={{ request.GET.location }}{% endif %}{% if request.GET.status %}&status={{ request.GET.status }}{% endif %}"
|
||||
class="pagination-link">Next</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
48
templates/parks/partials/park_list.html
Normal file
48
templates/parks/partials/park_list.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{% for park in parks %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden transform transition-transform hover:-translate-y-1">
|
||||
{% if park.photos.first %}
|
||||
<img src="{{ park.photos.first.image.url }}"
|
||||
alt="{{ park.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="{% url 'parks:park_detail' slug=park.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">{{ park.name }}</a>
|
||||
</h3>
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">{{ park.location }}</p>
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ park.rides.count }} attractions
|
||||
</span>
|
||||
{% if park.average_rating %}
|
||||
<div class="flex items-center">
|
||||
<span class="text-yellow-400 mr-1">★</span>
|
||||
<span class="text-gray-600 dark:text-gray-400">{{ park.average_rating|floatformat:1 }}/10</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if park.status != 'OPERATING' %}
|
||||
<div class="mt-2">
|
||||
<span class="px-2 py-1 text-xs rounded-full
|
||||
{% if park.status == 'CLOSED_TEMP' %}bg-yellow-100 text-yellow-800
|
||||
{% elif park.status == 'CLOSED_PERM' %}bg-red-100 text-red-800
|
||||
{% elif park.status == 'UNDER_CONSTRUCTION' %}bg-blue-100 text-blue-800
|
||||
{% elif park.status == 'DEMOLISHED' %}bg-gray-100 text-gray-800
|
||||
{% endif %}">
|
||||
{{ park.get_status_display }}
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% empty %}
|
||||
<div class="col-span-full text-center py-8">
|
||||
<p class="text-gray-500 dark:text-gray-400">No parks found matching your criteria.</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
60
templates/rides/partials/ride_list.html
Normal file
60
templates/rides/partials/ride_list.html
Normal file
@@ -0,0 +1,60 @@
|
||||
{% for ride in rides %}
|
||||
<div class="bg-white dark:bg-gray-800 shadow rounded-lg overflow-hidden transform transition-transform hover:-translate-y-1">
|
||||
{% if ride.photos.first %}
|
||||
<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="{% url 'rides:ride_detail' park_slug=ride.park.slug ride_slug=ride.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">{{ ride.name }}</a>
|
||||
</h3>
|
||||
<p class="text-gray-600 dark:text-gray-400 mb-2">
|
||||
at <a href="{% url 'parks:park_detail' slug=ride.park.slug %}"
|
||||
class="text-blue-600 dark:text-blue-400 hover:underline">{{ 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 class="text-gray-600 dark:text-gray-400">{{ 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">
|
||||
{% if ride.coaster_stats.height_ft %}
|
||||
<div>Height: {{ ride.coaster_stats.height_ft|floatformat:0 }}ft</div>
|
||||
{% endif %}
|
||||
{% if ride.coaster_stats.speed_mph %}
|
||||
<div>Speed: {{ ride.coaster_stats.speed_mph|floatformat:0 }}mph</div>
|
||||
{% endif %}
|
||||
<div>Inversions: {{ ride.coaster_stats.inversions }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if ride.status != 'OPERATING' %}
|
||||
<div class="mt-2">
|
||||
<span class="px-2 py-1 text-xs rounded-full
|
||||
{% if ride.status == 'CLOSED_TEMP' %}bg-yellow-100 text-yellow-800
|
||||
{% elif ride.status == 'CLOSED_PERM' %}bg-red-100 text-red-800
|
||||
{% elif ride.status == 'UNDER_CONSTRUCTION' %}bg-blue-100 text-blue-800
|
||||
{% elif ride.status == 'DEMOLISHED' %}bg-gray-100 text-gray-800
|
||||
{% endif %}">
|
||||
{{ ride.get_status_display }}
|
||||
</span>
|
||||
</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 %}
|
||||
@@ -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