50 lines
1.8 KiB
HTML
50 lines
1.8 KiB
HTML
{% extends "admin/base.html" %}
|
||
{% block title %}{{ 'Edit section' if section else 'New section' }}{% endblock %}
|
||
|
||
{% macro val(field, default='') -%}
|
||
{%- if form is not none -%}{{ form.get(field, default) }}
|
||
{%- elif section is not none -%}{{ section[field] if section[field] is not none else default }}
|
||
{%- else -%}{{ default }}{%- endif -%}
|
||
{%- endmacro %}
|
||
|
||
{% block content %}
|
||
<header class="page-head">
|
||
<div>
|
||
<h1>{{ 'Edit section' if section else 'New section' }}</h1>
|
||
<p class="muted">{{ section.title if section else 'Sections group topics on the public page.' }}</p>
|
||
</div>
|
||
<a class="btn btn--ghost" href="{{ url_for('admin.dashboard') }}">← Back</a>
|
||
</header>
|
||
|
||
<form method="post" class="form-card stack"
|
||
action="{{ url_for('admin.section_form', section_id=section.id) if section else url_for('admin.section_form') }}">
|
||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||
|
||
<div class="grid-2">
|
||
<label class="field">
|
||
<span>Number * <small class="muted">(shown as §NN, must be unique)</small></span>
|
||
<input type="number" name="num" value="{{ val('num') }}" required>
|
||
</label>
|
||
<label class="field">
|
||
<span>Sort order <small class="muted">(defaults to number × 10)</small></span>
|
||
<input type="number" name="sort_order" value="{{ val('sort_order') }}" placeholder="auto">
|
||
</label>
|
||
</div>
|
||
|
||
<label class="field">
|
||
<span>Title *</span>
|
||
<input type="text" name="title" value="{{ val('title') }}" required>
|
||
</label>
|
||
|
||
<label class="field">
|
||
<span>Subtitle</span>
|
||
<input type="text" name="subtitle" value="{{ val('subtitle') }}">
|
||
</label>
|
||
|
||
<div class="form-actions">
|
||
<a class="btn btn--ghost" href="{{ url_for('admin.dashboard') }}">Cancel</a>
|
||
<button class="btn btn--primary" type="submit">Save section</button>
|
||
</div>
|
||
</form>
|
||
{% endblock %}
|