diff --git a/.idea/dataSources.local.xml b/.idea/dataSources.local.xml index b341a8a..707e2b3 100644 --- a/.idea/dataSources.local.xml +++ b/.idea/dataSources.local.xml @@ -1,6 +1,6 @@ - + " diff --git a/content/profile.php b/content/profile.php index 815e5ad..b784d93 100644 --- a/content/profile.php +++ b/content/profile.php @@ -81,10 +81,12 @@ $isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error);
-
+ +
@@ -154,14 +156,16 @@ $isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error); Bearbeiten -
+ +
@@ -172,11 +176,9 @@ $isEditMode = (isset($_GET["edit"]) && $_GET["edit"] === "1") || !empty($error);

Du hast noch keine Beiträge erstellt.

- + diff --git a/content/search-results.php b/content/search-results.php index d9a6399..740a22e 100644 --- a/content/search-results.php +++ b/content/search-results.php @@ -124,7 +124,9 @@ $categories = [ @@ -193,17 +195,34 @@ $categories = [ diff --git a/content/showArticle.php b/content/showArticle.php index c5152c1..dd99c1e 100644 --- a/content/showArticle.php +++ b/content/showArticle.php @@ -237,7 +237,7 @@ if ($replyAuthor === null) {
+ class="delete-comment-form confirm-delete-comment"> ">
@@ -369,7 +368,7 @@ if ($replyAuthor === null) {
+ class="delete-comment-form confirm-delete-comment"> ">
diff --git a/index.php b/index.php index 42d054c..0f2fc97 100644 --- a/index.php +++ b/index.php @@ -24,9 +24,10 @@ include_once "php/controller/index-controller.php"; + - + EduForge diff --git a/js/comments.js b/js/comments.js index b9b83b0..d1c648b 100644 --- a/js/comments.js +++ b/js/comments.js @@ -11,6 +11,26 @@ document.addEventListener("DOMContentLoaded", function () { const parentCommentInput = document.getElementById("parent-comment-id"); 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) { return; } @@ -152,7 +172,6 @@ document.addEventListener("DOMContentLoaded", function () { @@ -230,7 +249,6 @@ document.addEventListener("DOMContentLoaded", function () { diff --git a/js/profile.js b/js/profile.js new file mode 100644 index 0000000..a11241c --- /dev/null +++ b/js/profile.js @@ -0,0 +1,29 @@ +document.addEventListener("DOMContentLoaded", function () { + + const deleteAccountForm = document.querySelector(".confirm-delete-account"); + + if (deleteAccountForm) { + deleteAccountForm.addEventListener("submit", function (event) { + + if (!confirm("Möchtest du deinen Account und alle deine Beiträge wirklich unwiderruflich löschen?")) { + event.preventDefault(); + } + + }); + } + + const deleteArticleForms = document.querySelectorAll(".confirm-delete-article"); + + deleteArticleForms.forEach(function (form) { + + form.addEventListener("submit", function (event) { + + if (!confirm("Möchtest du diesen Artikel wirklich löschen?")) { + event.preventDefault(); + } + + }); + + }); + +}); \ No newline at end of file