{% extends "base.html" %} {% block title %}Moderacja Forum - Norda Biznes Hub{% endblock %} {% block extra_css %} {% endblock %} {% block content %}

Moderacja Forum

Zarzadzaj tematami i odpowiedziami na forum

{{ total_topics }}
Tematow
{{ total_replies }}
Odpowiedzi
{{ pinned_count }}
Przypietych
{{ locked_count }}
Zamknietych

Tematy

{% if topics %} {% for topic in topics %} {% endfor %}
Tytul Autor Odpowiedzi Data Status Akcje
{{ topic.author.name or topic.author.email.split('@')[0] }} {{ topic.reply_count }} {{ topic.created_at.strftime('%d.%m.%Y') }} {% if topic.is_pinned %} Przypiety {% endif %} {% if topic.is_locked %} Zamkniety {% endif %}
{% else %}

Brak tematow na forum

{% endif %}

Ostatnie odpowiedzi

{% if recent_replies %}
{% for reply in recent_replies %}
{{ reply.content[:200] }}{% if reply.content|length > 200 %}...{% endif %}
{{ reply.author.name or reply.author.email.split('@')[0] }} w temacie {{ reply.topic.title[:30] }}{% if reply.topic.title|length > 30 %}...{% endif %} • {{ reply.created_at.strftime('%d.%m.%Y %H:%M') }}
{% endfor %}
{% else %}

Brak odpowiedzi

{% endif %}
{% endblock %} {% block extra_js %} const csrfToken = '{{ csrf_token() }}'; function showMessage(message, type) { // Simple alert for now - could be improved with toast notifications alert(message); } async function togglePin(topicId) { try { const response = await fetch(`/admin/forum/topic/${topicId}/pin`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken } }); const data = await response.json(); if (data.success) { location.reload(); } else { showMessage(data.error || 'Wystapil blad', 'error'); } } catch (error) { showMessage('Blad polaczenia', 'error'); } } async function toggleLock(topicId) { try { const response = await fetch(`/admin/forum/topic/${topicId}/lock`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken } }); const data = await response.json(); if (data.success) { location.reload(); } else { showMessage(data.error || 'Wystapil blad', 'error'); } } catch (error) { showMessage('Blad polaczenia', 'error'); } } async function deleteTopic(topicId, title) { if (!confirm(`Czy na pewno chcesz usunac temat "${title}"?\n\nTa operacja usunie rowniez wszystkie odpowiedzi i jest nieodwracalna.`)) { return; } try { const response = await fetch(`/admin/forum/topic/${topicId}/delete`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken } }); const data = await response.json(); if (data.success) { document.querySelector(`tr[data-topic-id="${topicId}"]`).remove(); } else { showMessage(data.error || 'Wystapil blad', 'error'); } } catch (error) { showMessage('Blad polaczenia', 'error'); } } async function deleteReply(replyId) { if (!confirm('Czy na pewno chcesz usunac te odpowiedz?')) { return; } try { const response = await fetch(`/admin/forum/reply/${replyId}/delete`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRFToken': csrfToken } }); const data = await response.json(); if (data.success) { document.querySelector(`div[data-reply-id="${replyId}"]`).remove(); } else { showMessage(data.error || 'Wystapil blad', 'error'); } } catch (error) { showMessage('Blad polaczenia', 'error'); } } {% endblock %}