65 lines
2.7 KiB
HTML
65 lines
2.7 KiB
HTML
{% extends "admin/base.html" %}
|
|
{% block title %}Dashboard{% endblock %}
|
|
{% block content %}
|
|
<header class="page-head">
|
|
<div>
|
|
<h1>Content</h1>
|
|
<p class="muted">Edit the sections and topics shown on the public site.</p>
|
|
</div>
|
|
<div class="page-head__actions">
|
|
<a class="btn btn--ghost" href="{{ url_for('admin.section_form') }}">+ Section</a>
|
|
<a class="btn btn--primary" href="{{ url_for('admin.topic_form') }}">+ Topic</a>
|
|
</div>
|
|
</header>
|
|
|
|
{% if not sections %}
|
|
<div class="empty">No sections yet. Start by adding one.</div>
|
|
{% endif %}
|
|
|
|
{% for section in sections %}
|
|
<section class="sec-card">
|
|
<div class="sec-card__head">
|
|
<div class="sec-card__meta">
|
|
<span class="pill">§{{ '%02d' % section.num }}</span>
|
|
<h2>{{ section.title }}</h2>
|
|
{% if section.subtitle %}<span class="muted">{{ section.subtitle }}</span>{% endif %}
|
|
</div>
|
|
<div class="sec-card__actions">
|
|
<a class="btn btn--ghost btn--sm" href="{{ url_for('admin.section_form', section_id=section.id) }}">Edit</a>
|
|
<a class="btn btn--ghost btn--sm" href="{{ url_for('admin.topic_form') }}?section={{ section.id }}">+ Topic</a>
|
|
<form method="post" action="{{ url_for('admin.section_delete', section_id=section.id) }}"
|
|
onsubmit="return confirm('Delete section “{{ section.title }}” and ALL its topics?');">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="btn btn--danger btn--sm" type="submit">Delete</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
{% if section.topics %}
|
|
<ul class="topic-rows">
|
|
{% for topic in section.topics %}
|
|
<li class="topic-row">
|
|
<div class="topic-row__main">
|
|
<span class="topic-row__order">{{ topic.sort_order }}</span>
|
|
<a class="topic-row__title" href="{{ url_for('admin.topic_form', topic_id=topic.id) }}">{{ topic.title | safe }}</a>
|
|
{% if topic.media_type and topic.media_type != 'none' %}<span class="chip">{{ topic.media_type }}</span>{% endif %}
|
|
{% if topic.link_url %}<span class="chip chip--link">link</span>{% endif %}
|
|
</div>
|
|
<div class="topic-row__actions">
|
|
<a class="btn btn--ghost btn--sm" href="{{ url_for('admin.topic_form', topic_id=topic.id) }}">Edit</a>
|
|
<form method="post" action="{{ url_for('admin.topic_delete', topic_id=topic.id) }}"
|
|
onsubmit="return confirm('Delete topic “{{ topic.title }}”?');">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="btn btn--danger btn--sm" type="submit">Delete</button>
|
|
</form>
|
|
</div>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
<p class="muted sec-card__empty">No topics in this section yet.</p>
|
|
{% endif %}
|
|
</section>
|
|
{% endfor %}
|
|
{% endblock %}
|