diff --git a/client/js/admin/forum.js b/client/js/admin/forum.js index 870a41b..94c2746 100644 --- a/client/js/admin/forum.js +++ b/client/js/admin/forum.js @@ -1,6 +1,6 @@ function loadForumPosts() { const contentArea = $('#content-area'); - contentArea.html('

Forum Posts and Replies

'); + contentArea.html('

Forum Posts and Replies

'); $.ajax({ url: '/api/admin/forum-posts', @@ -24,14 +24,14 @@ function displayForumPosts(posts) { posts.forEach(post => { const sectionName = getSectionName(post.section); const postElement = $(` -
+

${escapeHtml(post.title)}

-

${escapeHtml(post.content ? post.content.substring(0, 200) : '')}...

+

${escapeHtml(post.content ? post.content.substring(0, 200) : '')}...

    @@ -39,7 +39,9 @@ function displayForumPosts(posts) {
  • Section: ${sectionName}
  • Created: ${new Date(post.createdAt).toLocaleString()}
- +
@@ -53,7 +55,7 @@ function displayForumPosts(posts) { const repliesList = postElement.find('.replies-list'); post.comments.forEach(reply => { repliesList.append(` -
+
@@ -64,7 +66,9 @@ function displayForumPosts(posts) {
  • Author: ${escapeHtml(reply.author.username)}
  • Created: ${new Date(reply.createdAt).toLocaleString()}
  • - +
    @@ -96,7 +100,6 @@ function deleteForumPost(postId) { 'Authorization': `Bearer ${localStorage.getItem('token')}` }, success: function(response) { -// console.log('Delete post response:', response); showAlert('success', 'Post deleted successfully.'); loadForumPosts(); }, @@ -122,7 +125,6 @@ function deleteForumReply(replyId) { 'Authorization': `Bearer ${localStorage.getItem('token')}` }, success: function(response) { - // console.log('Delete reply response:', response); showAlert('success', 'Reply deleted successfully.'); loadForumPosts(); }, @@ -147,9 +149,9 @@ function getSectionName(sectionId) { } function showAlert(type, message) { - const alertElement = $(`