Admin can now write posts

Posts can be displayed on the website. Subscribers are automatically
notified by email. This gives the opportunity to track explicitly how
many people followed the link provided in the emails sent without being
intrusive (no invisible image).
This commit is contained in:
Alphonse Paix
2025-09-18 17:22:33 +02:00
parent 044991d623
commit 54218f92a9
11 changed files with 284 additions and 69 deletions

View File

@@ -102,12 +102,12 @@
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z" />
</svg>
Send an issue
Write a new post
</h2>
<p class="text-sm text-gray-600 mt-1">Create and send a newsletter issue.</p>
<p class="text-sm text-gray-600 mt-1">Create a new post and notify your subscribers.</p>
</div>
<div class="p-6">
<form hx-post="/admin/newsletters"
<form hx-post="/admin/posts"
hx-target="#newsletter-messages"
hx-swap="innerHTML"
class="space-y-4">
@@ -121,21 +121,13 @@
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500" />
</div>
<div>
<label for="html" class="block text-sm font-medium text-gray-700 mb-2">HTML content</label>
<textarea id="html"
name="html"
<label for="content" class="block text-sm font-medium text-gray-700 mb-2">HTML content</label>
<textarea id="content"
name="content"
rows="6"
required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 font-mono text-sm"></textarea>
</div>
<div>
<label for="text" class="block text-sm font-medium text-gray-700 mb-2">Plain text content</label>
<textarea id="text"
name="text"
rows="6"
required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"></textarea>
</div>
<button type="submit"
class="w-full bg-blue-600 text-white hover:bg-blue-700 font-medium py-3 px-4 rounded-md transition-colors flex items-center justify-center">
<svg class="w-4 h-4 mr-2"
@@ -144,7 +136,7 @@
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
</svg>
Send
Create
</button>
<div id="newsletter-messages" class="mt-4"></div>
</form>