feat(newsletter): Add subscription confirmation email functionality
All checks were successful
CI / test (3.11) (push) Successful in 9m26s
CI / build-image (push) Successful in 49s

- Implemented `send_subscription_confirmation` function to send a confirmation email upon subscription.
- Added a default HTML template for the confirmation email in settings.
- Updated the newsletter management page to handle subscription and unsubscription actions.
- Created new templates for embedding contact and newsletter forms.
- Added styles for the new templates and unified CSS styles across the application.
- Updated tests to reflect changes in the newsletter management API endpoints.
This commit is contained in:
2025-10-30 12:38:26 +01:00
parent f7695be8ef
commit 56840ac313
24 changed files with 897 additions and 449 deletions

335
static/css/styles.css Normal file
View File

@@ -0,0 +1,335 @@
/* Unified CSS Styles */
/* Base styles */
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f9f9f9;
color: #333;
}
h1 {
color: #333;
text-align: center;
margin-bottom: 30px;
}
h2 {
color: #555;
border-bottom: 1px solid #ddd;
padding-bottom: 5px;
margin-bottom: 20px;
}
/* Form styles */
.form-container,
.contact-form,
.confirmation-container {
max-width: 600px;
margin: 0 auto;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.form-group,
.setting {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
input,
textarea,
select {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
textarea {
height: 100px;
resize: vertical;
}
button,
.btn {
background-color: #007bff;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
text-decoration: none;
display: inline-block;
}
button:hover,
.btn:hover {
background-color: #0056b3;
}
.btn-secondary {
background-color: #6c757d;
}
.btn-secondary:hover {
background-color: #545b62;
}
.btn-danger {
background-color: #dc3545;
}
.btn-danger:hover {
background-color: #c82333;
}
/* Message styles */
.message {
padding: 10px;
margin: 10px 0;
border-radius: 4px;
}
.message.success {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.message.error {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.message.info {
background-color: #d1ecf1;
color: #0c5460;
border: 1px solid #bee5eb;
}
/* Admin dashboard */
.dashboard-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 40px;
}
.dashboard-card {
border: 1px solid #ddd;
border-radius: 8px;
padding: 20px;
background-color: #f9f9f9;
transition: box-shadow 0.3s ease;
}
.dashboard-card:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.dashboard-card h2 {
color: #555;
margin-top: 0;
margin-bottom: 15px;
}
.dashboard-card p {
color: #666;
margin-bottom: 15px;
}
.stats {
display: flex;
justify-content: space-around;
margin-bottom: 30px;
flex-wrap: wrap;
}
.stat-card {
background-color: #e9ecef;
padding: 15px;
border-radius: 8px;
text-align: center;
min-width: 150px;
margin: 5px;
}
.stat-card h3 {
margin: 0;
color: #495057;
font-size: 2em;
}
.stat-card p {
margin: 5px 0 0 0;
color: #6c757d;
font-size: 0.9em;
}
.logout {
text-align: center;
margin-top: 40px;
}
.logout a {
color: #dc3545;
text-decoration: none;
}
.logout a:hover {
text-decoration: underline;
}
/* Admin settings */
.setting-group {
margin-bottom: 20px;
}
.setting strong {
display: inline-block;
width: 200px;
}
.settings-management {
margin-top: 40px;
padding: 20px;
border: 1px solid #ddd;
border-radius: 5px;
}
.settings-list {
margin-bottom: 20px;
}
.setting-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px;
border-bottom: 1px solid #eee;
}
.setting-item:last-child {
border-bottom: none;
}
.setting-info {
flex-grow: 1;
}
.setting-actions {
display: flex;
gap: 10px;
}
.form-row {
display: flex;
gap: 10px;
align-items: end;
}
.form-row .form-group {
flex: 1;
margin-bottom: 0;
}
.edit-form {
display: none;
margin-top: 10px;
padding: 10px;
background: #f8f9fa;
border-radius: 3px;
}
/* Newsletter manage */
.form-section {
margin: 20px 0;
padding: 20px;
border: 1px solid #ddd;
border-radius: 8px;
}
/* Navigation links */
nav a {
color: #007bff;
text-decoration: none;
margin-right: 20px;
}
nav a:hover {
text-decoration: underline;
}
/* Table styles */
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
th,
td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f8f9fa;
font-weight: bold;
}
tr:hover {
background-color: #f5f5f5;
}
/* Pagination */
.pagination {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 20px;
}
.pagination a,
.pagination span {
padding: 8px 12px;
text-decoration: none;
border: 1px solid #ddd;
border-radius: 4px;
color: #007bff;
}
.pagination a:hover {
background-color: #007bff;
color: white;
}
.pagination .current {
background-color: #007bff;
color: white;
}
/* Utility classes */
.text-center {
text-align: center;
}
.mt-20 {
margin-top: 20px;
}
.mb-20 {
margin-bottom: 20px;
}