73 lines
3.9 KiB
HTML
73 lines
3.9 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Manage Knowledge Base{% endblock %}
|
|
{% block page_title %}Knowledge Base Management{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="card">
|
|
<div class="card-header d-flex align-items-center justify-content-between">
|
|
<span><i class="bi bi-journal-text me-2"></i>Articles <span style="font-size:12px;color:var(--muted);">({{ articles|length }})</span></span>
|
|
<a href="{{ url_for('admin.kb_new') }}" class="btn btn-primary btn-sm">
|
|
<i class="bi bi-plus-lg me-1"></i>New Article
|
|
</a>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
{% if articles %}
|
|
<table class="table mb-0">
|
|
<thead>
|
|
<tr><th>Title</th><th>Category</th><th>Author</th><th>Published</th><th>Views</th><th>Updated</th><th>Actions</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for art in articles %}
|
|
<tr>
|
|
<td style="font-size:14px;">{{ art.title[:60] }}</td>
|
|
<td style="font-size:12px;color:var(--muted);">{{ art.category or '—' }}</td>
|
|
<td style="font-size:13px;">{{ art.author.full_name if art.author else '—' }}</td>
|
|
<td>
|
|
{% if art.is_published %}
|
|
<span style="color:var(--success);font-size:12px;"><i class="bi bi-check-circle-fill"></i> Yes</span>
|
|
{% else %}
|
|
<span style="color:var(--muted);font-size:12px;"><i class="bi bi-dash-circle"></i> Draft</span>
|
|
{% endif %}
|
|
</td>
|
|
<td style="font-size:12px;color:var(--muted);">{{ art.view_count }}</td>
|
|
<td style="font-size:12px;color:var(--muted);">{{ art.updated_at.strftime('%b %d, %Y') }}</td>
|
|
<td>
|
|
<div class="d-flex gap-1 align-items-center">
|
|
<a href="{{ url_for('tickets.kb_article', article_id=art.id) }}" class="btn btn-secondary btn-sm" title="Preview"><i class="bi bi-eye"></i></a>
|
|
<a href="{{ url_for('admin.kb_edit', article_id=art.id) }}" class="btn btn-secondary btn-sm" title="Edit"><i class="bi bi-pencil"></i></a>
|
|
<!-- Publish / Unpublish quick toggle -->
|
|
<form method="POST" action="{{ url_for('admin.kb_toggle_publish', article_id=art.id) }}" style="margin:0;">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
{% if art.is_published %}
|
|
<button type="submit" class="btn btn-sm"
|
|
style="background:rgba(251,191,36,.1);border:1px solid rgba(251,191,36,.3);color:var(--warning);"
|
|
title="Unpublish (move to draft)">
|
|
<i class="bi bi-eye-slash"></i>
|
|
</button>
|
|
{% else %}
|
|
<button type="submit" class="btn btn-sm"
|
|
style="background:rgba(5,150,105,.1);border:1px solid rgba(5,150,105,.3);color:var(--success);"
|
|
title="Publish now">
|
|
<i class="bi bi-send-check"></i> Publish
|
|
</button>
|
|
{% endif %}
|
|
</form>
|
|
<form method="POST" action="{{ url_for('admin.kb_delete', article_id=art.id) }}" onsubmit="return confirm('Delete this article?');" style="margin:0;">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/>
|
|
<button type="submit" class="btn btn-sm" style="background:rgba(248,113,113,.1);border:1px solid rgba(248,113,113,.2);color:var(--danger);" title="Delete"><i class="bi bi-trash"></i></button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<div class="p-5 text-center" style="color:var(--muted);">
|
|
<i class="bi bi-journal-x" style="font-size:40px;display:block;margin-bottom:12px;"></i>
|
|
No articles yet. <a href="{{ url_for('admin.kb_new') }}" style="color:var(--accent3);">Create your first article →</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock %} |