This commit is contained in:
2026-07-19 20:10:51 +02:00
parent d7d121b541
commit 5eca2f162b
4 changed files with 56 additions and 28 deletions
+16 -15
View File
@@ -123,9 +123,9 @@ $categories = [
</select> </select>
</div> </div>
<noscript> <button type="submit" class="nav__search-button">
<button type="submit" class="nav__search-button">Filter anwenden</button> Filter anwenden
</noscript> </button>
</form> </form>
</aside> </aside>
@@ -189,21 +189,22 @@ $categories = [
<option value="50" <?php echo $limit === 50 ? 'selected' : ''; ?>>50</option> <option value="50" <?php echo $limit === 50 ? 'selected' : ''; ?>>50</option>
<option value="100" <?php echo $limit === 100 ? 'selected' : ''; ?>>100</option> <option value="100" <?php echo $limit === 100 ? 'selected' : ''; ?>>100</option>
</select> </select>
<noscript><button type="submit" form="s-res-filter-form" class="nav__search-button">Übernehmen</button></noscript> <button type="submit"
form="s-res-filter-form"
class="nav__search-button">
Übernehmen
</button>
</div> </div>
<nav class="s-res-page-navigation" aria-label="Seitennavigation"> <nav class="s-res-page-navigation" aria-label="Seitennavigation">
<!-- No-JS-Fallback: --> <?php echo renderNoJsPagination(
<noscript> $currentPage,
<?php echo renderNoJsPagination($currentPage, $totalPages, $query, $currentSort, $currentCategory, $limit); ?> $totalPages,
</noscript> $query,
$currentSort,
<!-- JS-Version: wird per search-results.js befüllt/eingeblendet: --> $currentCategory,
<div id="js-page-navigation" style="display:none;"> $limit
<button type="button" class="s-res-page-btn" id="prev-page-btn">«</button> ); ?>
<span id="dynamic-page-numbers"></span>
<button type="button" class="s-res-page-btn" id="next-page-btn">»</button>
</div>
</nav> </nav>
</div> </div>
+17 -7
View File
@@ -251,12 +251,24 @@ if ($replyAuthor === null) {
(string) $comment->getArticleId() (string) $comment->getArticleId()
); ?>"> ); ?>">
<form method="post"
action="index.php?pfad=deleteComment"
class="delete-comment-form confirm-delete-comment">
<input type="hidden"
name="comment_id"
value="<?php echo htmlspecialchars((string) $comment->getId()); ?>">
<input type="hidden"
name="article_id"
value="<?php echo htmlspecialchars((string) $comment->getArticleId()); ?>">
<button type="submit" <button type="submit"
class="delete-comment-button" class="delete-comment-button">
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');">
Kommentar löschen Kommentar löschen
</button> </button>
</form> </form>
</form>
<?php endif; ?> <?php endif; ?>
@@ -383,11 +395,9 @@ if ($replyAuthor === null) {
(string) $reply->getArticleId() (string) $reply->getArticleId()
); ?>"> ); ?>">
<button type="submit" <form method="post"
class="delete-comment-button" action="index.php?pfad=deleteComment"
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');"> class="delete-comment-form confirm-delete-comment">
Kommentar löschen
</button>
</form> </form>
<?php endif; ?> <?php endif; ?>
-1
View File
@@ -26,7 +26,6 @@ include_once "php/controller/index-controller.php";
<script src="js/comments.js" defer></script> <script src="js/comments.js" defer></script>
<script src="js/profile.js" defer></script> <script src="js/profile.js" defer></script>
<script src="js/editor.js" async></script> <script src="js/editor.js" async></script>
<script src="js/search-results.js" async></script>
<script src="js/showCategory.js" async></script> <script src="js/showCategory.js" async></script>
+20 -2
View File
@@ -11,6 +11,26 @@ document.addEventListener("DOMContentLoaded", function () {
const parentCommentInput = document.getElementById("parent-comment-id"); const parentCommentInput = document.getElementById("parent-comment-id");
const replyInfo = document.getElementById("reply-info"); const replyInfo = document.getElementById("reply-info");
/**
* Fragt vor dem Löschen eines Kommentars nach einer Bestätigung.
*
* Der Listener funktioniert auch für Kommentare,
* die später per AJAX eingefügt werden.
*/
document.addEventListener("submit", function (event) {
if (!event.target.classList.contains("delete-comment-form")) {
return;
}
const confirmed = confirm(
"Möchtest du diesen Kommentar wirklich löschen?"
);
if (!confirmed) {
event.preventDefault();
}
});
if (!form || !commentsList || !commentContent || !parentCommentInput) { if (!form || !commentsList || !commentContent || !parentCommentInput) {
return; return;
} }
@@ -152,7 +172,6 @@ document.addEventListener("DOMContentLoaded", function () {
<button <button
type="submit" type="submit"
class="delete-comment-button" class="delete-comment-button"
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');"
> >
Kommentar löschen Kommentar löschen
</button> </button>
@@ -230,7 +249,6 @@ document.addEventListener("DOMContentLoaded", function () {
<button <button
type="submit" type="submit"
class="delete-comment-button" class="delete-comment-button"
onclick="return confirm('Möchtest du diesen Kommentar wirklich löschen?');"
> >
Kommentar löschen Kommentar löschen
</button> </button>