nordabiz/templates/forum/index.html
Maciej Pienczyn 61e70ad67c feat: Forum categories, statuses, and multi-file attachments
- Add category selection (feature_request, bug, question, announcement)
- Add status tracking (new, in_progress, resolved, rejected) with admin controls
- Add file attachments support (JPG, PNG, GIF up to 5MB)
- Multi-file upload (up to 10 files per reply) with drag & drop and paste
- New FileUploadService with EXIF stripping for privacy
- Admin panel with status statistics and change modal
- Grid display for multiple attachments

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 21:26:20 +01:00

451 lines
12 KiB
HTML
Executable File

{% extends "base.html" %}
{% block title %}Forum - Norda Biznes Hub{% endblock %}
{% block extra_css %}
<style>
.forum-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: var(--spacing-xl);
}
.forum-header h1 {
font-size: var(--font-size-3xl);
color: var(--text-primary);
}
.forum-stats {
color: var(--text-secondary);
font-size: var(--font-size-sm);
}
/* Filters bar */
.filters-bar {
display: flex;
gap: var(--spacing-md);
margin-bottom: var(--spacing-lg);
flex-wrap: wrap;
align-items: center;
}
.filter-group {
display: flex;
align-items: center;
gap: var(--spacing-sm);
}
.filter-label {
font-size: var(--font-size-sm);
color: var(--text-secondary);
font-weight: 500;
}
.filter-select {
padding: var(--spacing-sm) var(--spacing-md);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: var(--font-size-sm);
background: var(--surface);
cursor: pointer;
}
.filter-select:focus {
outline: none;
border-color: var(--primary);
}
.filter-reset {
font-size: var(--font-size-sm);
color: var(--text-secondary);
text-decoration: none;
}
.filter-reset:hover {
color: var(--primary);
}
.topics-list {
display: flex;
flex-direction: column;
gap: var(--spacing-md);
}
.topic-card {
background: var(--surface);
border-radius: var(--radius-lg);
padding: var(--spacing-lg);
box-shadow: var(--shadow);
transition: var(--transition);
display: grid;
grid-template-columns: 1fr auto;
gap: var(--spacing-lg);
align-items: center;
}
.topic-card:hover {
box-shadow: var(--shadow-md);
transform: translateY(-2px);
}
.topic-card.pinned {
border-left: 4px solid var(--primary);
background: linear-gradient(135deg, #eff6ff, var(--surface));
}
.topic-card.locked {
opacity: 0.7;
}
.topic-main {
min-width: 0;
}
.topic-title {
font-size: var(--font-size-lg);
font-weight: 600;
color: var(--text-primary);
text-decoration: none;
display: flex;
align-items: center;
gap: var(--spacing-sm);
flex-wrap: wrap;
}
.topic-title:hover {
color: var(--primary);
}
.topic-badge {
font-size: var(--font-size-xs);
padding: 2px 8px;
border-radius: var(--radius-sm);
font-weight: 500;
white-space: nowrap;
}
.badge-pinned {
background: var(--primary);
color: white;
}
.badge-locked {
background: var(--secondary);
color: white;
}
/* Category badges */
.badge-category {
border: 1px solid;
}
.badge-feature_request {
background: #dbeafe;
color: #1e40af;
border-color: #93c5fd;
}
.badge-bug {
background: #fee2e2;
color: #991b1b;
border-color: #fca5a5;
}
.badge-question {
background: #dcfce7;
color: #166534;
border-color: #86efac;
}
.badge-announcement {
background: #fef3c7;
color: #92400e;
border-color: #fcd34d;
}
/* Status badges */
.badge-status {
font-size: var(--font-size-xs);
padding: 2px 6px;
border-radius: var(--radius-sm);
}
.badge-new {
background: #f3f4f6;
color: #374151;
}
.badge-in_progress {
background: #dbeafe;
color: #1e40af;
}
.badge-resolved {
background: #dcfce7;
color: #166534;
}
.badge-rejected {
background: #fee2e2;
color: #991b1b;
}
.topic-meta {
display: flex;
gap: var(--spacing-lg);
margin-top: var(--spacing-sm);
font-size: var(--font-size-sm);
color: var(--text-secondary);
}
.topic-meta span {
display: flex;
align-items: center;
gap: var(--spacing-xs);
}
.topic-stats {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: var(--spacing-xs);
text-align: right;
}
.stat-item {
display: flex;
align-items: center;
gap: var(--spacing-xs);
font-size: var(--font-size-sm);
color: var(--text-secondary);
}
.stat-item strong {
color: var(--text-primary);
}
.empty-state {
text-align: center;
padding: var(--spacing-2xl);
color: var(--text-secondary);
}
.empty-state h3 {
margin-bottom: var(--spacing-md);
color: var(--text-primary);
}
.pagination {
display: flex;
justify-content: center;
gap: var(--spacing-sm);
margin-top: var(--spacing-xl);
}
.pagination a, .pagination span {
padding: var(--spacing-sm) var(--spacing-md);
border-radius: var(--radius);
text-decoration: none;
font-weight: 500;
}
.pagination a {
background: var(--surface);
color: var(--text-primary);
border: 1px solid var(--border);
}
.pagination a:hover {
background: var(--background);
border-color: var(--primary);
}
.pagination span.current {
background: var(--primary);
color: white;
}
@media (max-width: 768px) {
.forum-header {
flex-direction: column;
align-items: flex-start;
gap: var(--spacing-md);
}
.filters-bar {
flex-direction: column;
align-items: stretch;
}
.filter-group {
width: 100%;
}
.filter-select {
flex: 1;
}
.topic-card {
grid-template-columns: 1fr;
}
.topic-stats {
flex-direction: row;
align-items: center;
}
}
</style>
{% endblock %}
{% block content %}
<div class="forum-header">
<div>
<h1>Forum Norda Biznes</h1>
<p class="forum-stats">{{ total_topics }} tematow</p>
</div>
<a href="{{ url_for('forum_new_topic') }}" class="btn btn-primary">
+ Nowy temat
</a>
</div>
<!-- Filters -->
<div class="filters-bar">
<div class="filter-group">
<span class="filter-label">Kategoria:</span>
<select class="filter-select" id="categoryFilter" onchange="applyFilters()">
<option value="">Wszystkie</option>
{% for cat in categories %}
<option value="{{ cat }}" {% if category_filter == cat %}selected{% endif %}>
{{ category_labels.get(cat, cat) }}
</option>
{% endfor %}
</select>
</div>
<div class="filter-group">
<span class="filter-label">Status:</span>
<select class="filter-select" id="statusFilter" onchange="applyFilters()">
<option value="">Wszystkie</option>
{% for st in statuses %}
<option value="{{ st }}" {% if status_filter == st %}selected{% endif %}>
{{ status_labels.get(st, st) }}
</option>
{% endfor %}
</select>
</div>
{% if category_filter or status_filter %}
<a href="{{ url_for('forum_index') }}" class="filter-reset">Wyczysc filtry</a>
{% endif %}
</div>
{% if topics %}
<div class="topics-list">
{% for topic in topics %}
<article class="topic-card {% if topic.is_pinned %}pinned{% endif %} {% if topic.is_locked %}locked{% endif %}">
<div class="topic-main">
<a href="{{ url_for('forum_topic', topic_id=topic.id) }}" class="topic-title">
{% if topic.is_pinned %}
<span class="topic-badge badge-pinned">Przypiety</span>
{% endif %}
{% if topic.is_locked %}
<span class="topic-badge badge-locked">Zamkniety</span>
{% endif %}
<span class="topic-badge badge-category badge-{{ topic.category or 'question' }}">
{{ category_labels.get(topic.category, 'Pytanie') }}
</span>
<span class="topic-badge badge-status badge-{{ topic.status or 'new' }}">
{{ status_labels.get(topic.status, 'Nowy') }}
</span>
{{ topic.title }}
</a>
<div class="topic-meta">
<span>
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
{{ topic.author.name or topic.author.email.split('@')[0] }}
</span>
<span>
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="10"></circle>
<polyline points="12 6 12 12 16 14"></polyline>
</svg>
{{ topic.created_at.strftime('%d.%m.%Y %H:%M') }}
</span>
</div>
</div>
<div class="topic-stats">
<div class="stat-item">
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
</svg>
<strong>{{ topic.reply_count }}</strong> odpowiedzi
</div>
<div class="stat-item">
<svg width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"></path>
<circle cx="12" cy="12" r="3"></circle>
</svg>
<strong>{{ topic.views_count }}</strong> wyswietlen
</div>
</div>
</article>
{% endfor %}
</div>
{% if total_pages > 1 %}
<nav class="pagination">
{% if page > 1 %}
<a href="{{ url_for('forum_index', page=page-1, category=category_filter, status=status_filter) }}">&laquo; Poprzednia</a>
{% endif %}
{% for p in range(1, total_pages + 1) %}
{% if p == page %}
<span class="current">{{ p }}</span>
{% elif p <= 3 or p > total_pages - 3 or (p >= page - 1 and p <= page + 1) %}
<a href="{{ url_for('forum_index', page=p, category=category_filter, status=status_filter) }}">{{ p }}</a>
{% elif p == 4 or p == total_pages - 3 %}
<span>...</span>
{% endif %}
{% endfor %}
{% if page < total_pages %}
<a href="{{ url_for('forum_index', page=page+1, category=category_filter, status=status_filter) }}">Nastepna &raquo;</a>
{% endif %}
</nav>
{% endif %}
{% else %}
<div class="empty-state">
<svg width="64" height="64" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" style="margin: 0 auto var(--spacing-md); display: block; opacity: 0.5;">
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
</svg>
<h3>Brak tematow</h3>
<p>Badz pierwszy! Utworz nowy temat dyskusji.</p>
<a href="{{ url_for('forum_new_topic') }}" class="btn btn-primary mt-2">
+ Utworz pierwszy temat
</a>
</div>
{% endif %}
{% endblock %}
{% block extra_js %}
function applyFilters() {
const category = document.getElementById('categoryFilter').value;
const status = document.getElementById('statusFilter').value;
let url = '{{ url_for("forum_index") }}';
const params = new URLSearchParams();
if (category) params.set('category', category);
if (status) params.set('status', status);
if (params.toString()) {
url += '?' + params.toString();
}
window.location.href = url;
}
{% endblock %}