yurt
This commit is contained in:
47
templates/base.html
Normal file
47
templates/base.html
Normal file
@@ -0,0 +1,47 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>{% block title %}Pet Picture Queue{% endblock %}</title>
|
||||
<link
|
||||
href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
</head>
|
||||
<body class="bg-gray-100 min-h-screen">
|
||||
<nav class="bg-white shadow-lg">
|
||||
<div class="max-w-6xl mx-auto px-4">
|
||||
<div class="flex justify-between items-center py-4">
|
||||
<div class="text-xl font-semibold text-gray-800">
|
||||
<a href="{{ url_for('index') }}">Pet Picture Queue</a>
|
||||
</div>
|
||||
<div class="space-x-4">
|
||||
<a
|
||||
href="{{ url_for('index') }}"
|
||||
class="text-gray-600 hover:text-gray-800"
|
||||
>View Pictures</a
|
||||
>
|
||||
<a
|
||||
href="{{ url_for('upload') }}"
|
||||
class="text-gray-600 hover:text-gray-800"
|
||||
>Upload New</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="max-w-6xl mx-auto px-4 py-8">
|
||||
{% with messages = get_flashed_messages() %} {% if messages %} {% for
|
||||
message in messages %}
|
||||
<div
|
||||
class="bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4 mb-4"
|
||||
role="alert"
|
||||
>
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %} {% endif %} {% endwith %} {% block content %}{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
72
templates/index.html
Normal file
72
templates/index.html
Normal file
@@ -0,0 +1,72 @@
|
||||
{% extends "base.html" %} {% block title %}Pet Pictures - Pet Picture Queue{%
|
||||
endblock %} {% block content %}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
{% for picture in pictures %}
|
||||
<div
|
||||
class="bg-white rounded-lg shadow-md overflow-hidden {% if picture.posted %}opacity-50{% endif %}"
|
||||
>
|
||||
<div class="relative group">
|
||||
<a
|
||||
href="{{ url_for('static', filename='uploads/' + picture.filename) }}"
|
||||
target="_blank"
|
||||
class="block"
|
||||
>
|
||||
<img
|
||||
src="{{ url_for('static', filename='uploads/' + picture.filename) }}"
|
||||
alt="Pet picture from {{ picture.subscriber_name }}"
|
||||
class="w-full h-64 object-cover transition-transform duration-300 group-hover:scale-105"
|
||||
/>
|
||||
<div
|
||||
class="absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-20 transition-opacity duration-300 flex items-center justify-center"
|
||||
>
|
||||
<span
|
||||
class="text-white opacity-0 group-hover:opacity-100 transition-opacity duration-300"
|
||||
>
|
||||
Click to view
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="p-4">
|
||||
<h3 class="text-lg font-semibold text-gray-800">
|
||||
From: {{ picture.subscriber_name }}
|
||||
</h3>
|
||||
<p class="text-sm text-gray-600">Uploaded: {{ picture.uploaded_at }}</p>
|
||||
<div class="mt-4 space-y-2">
|
||||
<a
|
||||
href="{{ url_for('download_file', filename=picture.filename) }}"
|
||||
class="block w-full bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 transition-colors text-center"
|
||||
>
|
||||
Download Original
|
||||
</a>
|
||||
{% if not picture.posted %}
|
||||
<form
|
||||
action="{{ url_for('mark_posted', picture_id=picture.id) }}"
|
||||
method="POST"
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full bg-green-500 text-white px-4 py-2 rounded hover:bg-green-600 transition-colors"
|
||||
>
|
||||
Mark as Posted
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<div class="text-center text-green-600 font-semibold">✓ Posted</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col-span-full text-center py-12">
|
||||
<p class="text-gray-600 text-lg">No pet pictures uploaded yet.</p>
|
||||
<a
|
||||
href="{{ url_for('upload') }}"
|
||||
class="mt-4 inline-block bg-blue-500 text-white px-6 py-2 rounded hover:bg-blue-600 transition-colors"
|
||||
>
|
||||
Upload Your First Picture
|
||||
</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
82
templates/upload.html
Normal file
82
templates/upload.html
Normal file
@@ -0,0 +1,82 @@
|
||||
{% extends "base.html" %} {% block title %}Upload Pet Picture - Pet Picture
|
||||
Queue{% endblock %} {% block content %}
|
||||
<div class="max-w-2xl mx-auto">
|
||||
<div class="bg-white rounded-lg shadow-md p-6">
|
||||
<h2 class="text-2xl font-bold text-gray-800 mb-6">Upload Pet Picture</h2>
|
||||
|
||||
<form
|
||||
action="{{ url_for('upload') }}"
|
||||
method="POST"
|
||||
enctype="multipart/form-data"
|
||||
class="space-y-6"
|
||||
>
|
||||
<div>
|
||||
<label
|
||||
for="subscriber_name"
|
||||
class="block text-sm font-medium text-gray-700"
|
||||
>Subscriber Name</label
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
name="subscriber_name"
|
||||
id="subscriber_name"
|
||||
required
|
||||
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="picture" class="block text-sm font-medium text-gray-700"
|
||||
>Pet Picture</label
|
||||
>
|
||||
<div
|
||||
class="mt-1 flex justify-center px-6 pt-5 pb-6 border-2 border-gray-300 border-dashed rounded-md"
|
||||
>
|
||||
<div class="space-y-1 text-center">
|
||||
<svg
|
||||
class="mx-auto h-12 w-12 text-gray-400"
|
||||
stroke="currentColor"
|
||||
fill="none"
|
||||
viewBox="0 0 48 48"
|
||||
>
|
||||
<path
|
||||
d="M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
<div class="flex text-sm text-gray-600">
|
||||
<label
|
||||
for="picture"
|
||||
class="relative cursor-pointer bg-white rounded-md font-medium text-blue-600 hover:text-blue-500 focus-within:outline-none focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-blue-500"
|
||||
>
|
||||
<span>Upload a file</span>
|
||||
<input
|
||||
id="picture"
|
||||
name="picture"
|
||||
type="file"
|
||||
class="sr-only"
|
||||
accept="image/*"
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<p class="pl-1">or drag and drop</p>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500">PNG, JPG, GIF up to 10MB</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
Upload Picture
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user