Templates and TLS requests
All checks were successful
Rust / Test (push) Successful in 5m34s
Rust / Rustfmt (push) Successful in 22s
Rust / Clippy (push) Successful in 1m13s
Rust / Code coverage (push) Successful in 3m33s

Refactored HTML templates and added TLS back to issue HTTP requests
This commit is contained in:
Alphonse Paix
2025-09-29 02:39:53 +02:00
parent 3b727269c5
commit de44564ba0
29 changed files with 513 additions and 401 deletions

View File

@@ -0,0 +1,65 @@
{% extends "base.html" %}
{% block title %}Unsubscribe{% endblock %}
{% block content %}
<div class="py-8 px-4 sm:px-6 lg:px-8">
<div class="max-w-md mx-auto">
<div class="bg-white rounded-lg shadow-md border border-gray-200 p-8">
<div class="text-center mb-8">
<div class="w-16 h-16 bg-orange-100 rounded-full flex items-center justify-center mx-auto mb-4">
<svg class="w-8 h-8 text-orange-600"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" opacity="0.7" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M7 11h10M7 14h6" opacity="0.3" />
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 8l8 8M16 8l-8 8" stroke="#dc2626" opacity="0.8" />
</svg>
</div>
<h1 class="text-2xl font-bold text-gray-900 mb-2">Unsubscribe</h1>
<p class="text-gray-600 text-sm">I'm sorry to see you go. Enter your email address below to unsubscribe.</p>
</div>
<form hx-post="/unsubscribe"
hx-target="#unsubscribe-messages"
hx-swap="innerHTML"
class="space-y-6">
<div>
<input type="email"
id="email"
name="email"
required
placeholder="you@example.com"
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500 focus:border-orange-500 transition-colors">
</div>
<div class="bg-amber-50 border border-amber-200 rounded-lg p-4">
<div class="flex items-center">
<svg class="w-5 h-5 text-amber-600 mt-0.5 mr-2 flex-shrink-0"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div class="text-sm text-amber-800">
<p>You will receive an email with a confirmation link.</p>
</div>
</div>
</div>
<button type="submit"
class="w-full bg-orange-600 text-white hover:bg-orange-700 font-medium py-3 px-4 rounded-md transition-colors flex items-center justify-center">
Unsubscribe
</button>
<div id="unsubscribe-messages" class="mt-4"></div>
</form>
<div class="mt-8 pt-6 border-t border-gray-200 text-center">
<p class="text-sm text-gray-500 mb-4">Changed your mind?</p>
<div class="flex flex-col sm:flex-row gap-2 justify-center items-center">
<a href="/"
class="text-blue-600 hover:text-blue-700 text-sm font-medium">Back to homepage</a>
<span class="hidden sm:inline text-gray-300"></span>
<a href="/posts"
class="text-blue-600 hover:text-blue-700 text-sm font-medium">See latest posts</a>
</div>
</div>
</div>
</div>
</div>
{% endblock %}