{% extends "base_template.html" %} {% from "courses/admin/_form.html" import field, flashes, visibility with context %} {% block title %}{{ page.name if page else _('New page') }}{% endblock %} {% block content %}

{{ page.name if page else _('New page') }}

{{ course.name }}

{{ _('Back to the course') }} {% if page %} {{ _('View') }} {{ _('History') }} {% endif %}
{{ flashes() }}
{{ form.hidden_tag() }}
{{ field(form.name) }}
{{ field(form.category_id) }}
{{ form.body_md.label(class="form-label") }} {# The editor attaches to this attribute and writes back into the field, so the form posts markdown either way and the page stays editable if the script does not load. #} {{ form.body_md(class="form-control font-monospace", rows=24, **{"data-courses-editor": "1", "data-preview-url": url_for('courses.admin_preview')}) }}
{{ _('Markdown. Tables, footnotes and existing HTML are all kept.') }}
{% for error in form.body_md.errors %}
{{ error }}
{% endfor %}
{% if preview_html is not none %} {# Rendered by the same helper the public page uses, so what you approve here is exactly what a reader is served. #}
{{ preview_html }}
{% endif %}
{{ field(form.position, type="number", min="0") }}
{{ visibility(form) }}
{% if page %}
{{ _('Files') }}
{{ _('Attachments inherit this page. They are refused until it is released, to a link that was forwarded exactly as to a guess.') }}
{% for attachment in attachments %} {% else %} {% endfor %}
{{ attachment.name or _('Attachment') }} {{ _('Open') }}
{{ confirm_form.hidden_tag() }}
{{ _('No files attached to this page.') }}
{{ attachment_form.hidden_tag() }}
{{ attachment_form.file.label(class="form-label") }} {{ attachment_form.file(class="form-control") }}
{{ attachment_form.name.label(class="form-label") }} {{ attachment_form.name(class="form-control", placeholder=_('Optional, defaults to the file name')) }}
{{ attachment_form.submit(class="btn btn-primary w-100") }}
{% endif %} {% endblock %}