Löschen Button verschönert

This commit is contained in:
2026-07-19 17:51:52 +02:00
parent d9da018ac2
commit 4f4ad9599d
2 changed files with 102 additions and 8 deletions
+38 -2
View File
@@ -5,6 +5,28 @@ $repliesByParent = [];
$articleObj = null; $articleObj = null;
include_once 'php/controller/showArticle-controller.php'; include_once 'php/controller/showArticle-controller.php';
require_once 'php/model/UserManager.php';
$userManager = UserManager::getInstance();
/**
* Liefert den vollständigen Namen zu einer gespeicherten E-Mail-Adresse.
* Falls kein Benutzer gefunden wird, wird die E-Mail als Ersatz angezeigt.
*/
function getCommentAuthorName($email, $userManager)
{
$user = $userManager->findUser($email);
if ($user === null) {
return $email;
}
$fullName = trim(
($user["vorname"] ?? "") . " " . ($user["nachname"] ?? "")
);
return $fullName !== "" ? $fullName : $email;
}
/* /*
* Ermittelt, ob ohne JavaScript auf einen Kommentar * Ermittelt, ob ohne JavaScript auf einen Kommentar
* geantwortet werden soll. * geantwortet werden soll.
@@ -173,7 +195,14 @@ if ($replyAuthor === null) {
<p> <p>
<strong> <strong>
<?php echo htmlspecialchars($comment->getAuthor()); ?> <?php
echo htmlspecialchars(
getCommentAuthorName(
$comment->getAuthor(),
$userManager
)
);
?>
</strong> </strong>
<span> <span>
@@ -304,7 +333,14 @@ if ($replyAuthor === null) {
<p> <p>
<strong> <strong>
<?php echo htmlspecialchars($reply->getAuthor()); ?> <?php
echo htmlspecialchars(
getCommentAuthorName(
$reply->getAuthor(),
$userManager
)
);
?>
</strong> </strong>
<span> <span>
+64 -6
View File
@@ -237,11 +237,6 @@ h1 {
text-decoration: none; text-decoration: none;
box-sizing: border-box; box-sizing: border-box;
} }
/* Deutlichere Klickreaktion für normale Buttons */
.button:active {
transform: translateY(1px);
box-shadow: none;
}
/* Deutlichere Klickreaktion für Kategorien */ /* Deutlichere Klickreaktion für Kategorien */
.category-link:active { .category-link:active {
@@ -325,7 +320,8 @@ h1 {
#comments-list button { #comments-list button {
cursor: pointer; cursor: pointer;
}.delete-comment-button { }
.delete-comment-button {
display: inline-block; display: inline-block;
background: #ffffff; background: #ffffff;
color: #dc2626; color: #dc2626;
@@ -357,3 +353,65 @@ h1 {
margin-top: 12px; margin-top: 12px;
margin-bottom: 12px; margin-bottom: 12px;
} }
/* Button zum Öffnen der Kommentarbearbeitung */
.edit-comment-button {
display: inline-block;
width: auto;
padding: 10px 18px;
background-color: #2563eb;
color: #ffffff;
border: 2px solid #2563eb;
border-radius: 8px;
font-size: 0.95rem;
font-weight: 600;
cursor: pointer;
list-style: none;
transition:
background-color 0.2s ease,
border-color 0.2s ease,
transform 0.2s ease,
box-shadow 0.2s ease;
}
/* Entfernt das normale Dreieck in einigen Browsern */
.edit-comment-button::-webkit-details-marker {
display: none;
}
/* Eigenes Symbol vor dem Text */
.edit-comment-button::before {
content: "✏ ";
}
.edit-comment-button:hover {
background-color: #1e40af;
border-color: #1e40af;
transform: translateY(-2px);
box-shadow: 0 5px 12px rgba(37, 99, 235, 0.3);
}
.edit-comment-button:active {
transform: translateY(1px);
box-shadow: none;
}
.edit-comment-button:focus-visible {
outline: 3px solid #fbbf24;
outline-offset: 3px;
}
/* Abstand zwischen Bearbeiten und Löschen */
.edit-comment-details {
margin-bottom: 12px;
}
/* Geöffneter Bearbeitungsbereich */
.edit-comment-details[open] .edit-comment-button {
margin-bottom: 12px;
background-color: #1e40af;
}
/* Geändertes Symbol, wenn der Bereich geöffnet ist */
.edit-comment-details[open] .edit-comment-button::before {
content: "▲ ";
}