moved add news button

This commit is contained in:
2026-06-16 15:32:39 +02:00
parent 6898a837e8
commit 336e7cf3a6
3 changed files with 53 additions and 10 deletions

View File

@@ -275,7 +275,26 @@ function sortCommentRows(sortBy) {
// =====================================================================
// Block 7: Helper Functions
// Block 7: News Filter and Sorting
// =====================================================================
// Sorts News
function sortNewsRows(sortBy) {
var container = document.getElementById('tab-news');
var rows = Array.from(container.querySelectorAll('.contribution-row'));
rows.sort(function (a, b) {
if (sortBy === 'date-desc') return new Date(b.dataset.date || 0) - new Date(a.dataset.date || 0);
if (sortBy === 'date-asc') return new Date(a.dataset.date || 0) - new Date(b.dataset.date || 0);
return 0;
});
rows.forEach(function (row) { row.parentNode.appendChild(row); });
}
// =====================================================================
// Block 8: Helper Functions
// =====================================================================
// Sends a POST request to API
@@ -301,7 +320,7 @@ function escapeHtml(text) {
}
// =====================================================================
// Block 8: CRUD Operations for Contributions
// Block 9: CRUD Operations for Contributions
// =====================================================================
// STATUS: Changes Contribution Status
@@ -406,7 +425,7 @@ function deleteContribution(contributionId) {
}
// =====================================================================
// Block 9: CRUD Operations for Comments
// Block 10: CRUD Operations for Comments
// =====================================================================
// STATUS: Changes Comment Status
@@ -501,7 +520,7 @@ function deleteModComment(commentId) {
// =====================================================================
// Block 10: CRUD Operations for News
// Block 11: CRUD Operations for News
// =====================================================================
// CREATE: Submits new News Article