Blockchain_KM/app/templates/admin/subtopics.html
2024-12-02 01:18:08 +08:00

58 lines
2.4 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="container mt-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>子知識點管理</h2>
<a href="{{ url_for('main.add_subtopic') }}" class="btn btn-primary">新增子知識點</a>
</div>
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="alert alert-{{ category }}">{{ message }}</div>
{% endfor %}
{% endif %}
{% endwith %}
<div class="card">
<div class="card-body">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>所屬主題</th>
<th>標題</th>
<th>內容</th>
<th>關鍵字</th>
<th>操作</th>
</tr>
</thead>
<tbody>
{% for subtopic in subtopics %}
<tr>
<td>{{ subtopic.topic.title }}</td>
<td>{{ subtopic.title }}</td>
<td>{{ subtopic.content[:50] + '...' if subtopic.content|length > 50 else subtopic.content }}</td>
<td>
{% for keyword in subtopic.keywords %}
<span class="badge bg-secondary">{{ keyword.term }}</span>
{% endfor %}
</td>
<td>
<a href="{{ url_for('main.edit_subtopic', subtopic_id=subtopic.id) }}"
class="btn btn-sm btn-primary">編輯</a>
<a href="{{ url_for('main.delete_subtopic', subtopic_id=subtopic.id) }}"
class="btn btn-sm btn-danger"
onclick="return confirm('確定要刪除此子知識點嗎?')">刪除</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endblock %}