Files
Escapepage/templates/game/admin/contact/show.html.twig
T
Frank e470a9848d Add read-tracking and soft-delete to contact messages
Admin can now open a message via a per-row "View" page (which stamps
read_at the first time it's opened), see a sortable Read column on the
list instead of the raw message text, and soft-delete messages via a
Delete button on both the list and detail view. Deleted messages are
excluded from the default list so it doesn't pile up over time.
2026-08-29 11:19:54 +02:00

54 lines
2.5 KiB
Twig

{% extends 'game/admin/base.html.twig' %}
{% block title %}Message from {{ message.name }} — Admin{% endblock %}
{% block admin_body %}
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;">
<h1 style="margin: 0; font-size: 1.5rem; color: #0f172a;">Message from {{ message.name }}</h1>
<a href="{{ path('game_admin_contact') }}" style="color: #3b82f6; text-decoration: none; font-size: 0.85rem;">&larr; Back to Contact Messages</a>
</div>
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); padding: 1.5rem; max-width: 720px;">
<dl style="display: grid; grid-template-columns: 140px 1fr; row-gap: 0.75rem; margin: 0 0 1.5rem;">
<dt style="color: #64748b; font-weight: 600;">Name</dt>
<dd style="margin: 0; color: #0f172a;">{{ message.name }}</dd>
<dt style="color: #64748b; font-weight: 600;">Email</dt>
<dd style="margin: 0;">
<a href="mailto:{{ message.email }}" style="color: #3b82f6; text-decoration: none;">{{ message.email }}</a>
</dd>
<dt style="color: #64748b; font-weight: 600;">Received</dt>
<dd style="margin: 0; color: #0f172a;">{{ message.createdAt|date('Y-m-d H:i:s') }}</dd>
<dt style="color: #64748b; font-weight: 600;">Read at</dt>
<dd style="margin: 0; color: #0f172a;">
{% if message.readAt %}
{{ message.readAt|date('Y-m-d H:i:s') }}
{% else %}
<span style="color: #94a3b8;">Just now</span>
{% endif %}
</dd>
</dl>
<hr style="border-color: #f1f5f9; margin-bottom: 1.5rem;">
<div style="white-space: pre-wrap; color: #0f172a; line-height: 1.6; margin-bottom: 1.5rem;">{{ message.message }}</div>
<hr style="border-color: #f1f5f9; margin-bottom: 1.5rem;">
<form method="post" action="{{ path('game_admin_contact_delete', {id: message.id}) }}" onsubmit="return confirm('Delete message from {{ message.name }}?')">
<input type="hidden" name="_token" value="{{ csrf_token('delete_contact_' ~ message.id) }}">
<button type="submit" style="
background: none;
border: 1px solid #fca5a5;
color: #ef4444;
cursor: pointer;
font-size: 0.85rem;
padding: 0.4rem 0.9rem;
border-radius: 6px;
">Delete Message</button>
</form>
</div>
{% endblock %}