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

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

{{ _('Back to courses') }}
{{ flashes() }}
{{ form.hidden_tag() }} {{ field(form.name) }} {{ field(form.description, rows=3) }} {% if course %} {{ visibility(form) }} {% else %} {# A new course is born withheld. It is filled before anyone sees it, so the release date is a decision for later. #}
{{ form.hidden(class="form-check-input") }} {{ form.hidden.label(class="form-check-label") }}
{{ _('Leave this on until the year is ready. You can schedule it once it has material.') }}
{{ field(form.categories, rows=5) }}
{{ _('One section per line. These are the divisions of the course, such as theory and lab work.') }}
{% endif %}
{% if course %}

{{ _('Contents') }}

{{ _('New section') }} {{ _('New page') }}
{% for category, pages in sections %}
{{ category.name }} {{ state_badge(category) }} {% if not category.is_released() %}
{{ _('Everything in this section is withheld with it.') }}
{% endif %}
{{ _('New page') }} {{ _('Edit') }} {{ delete_button(url_for('courses.admin_category_delete', category_id=category.id), confirm_form, _('Remove this section and its pages?')) }}
{% for page in pages %} {% else %} {% endfor %}
{{ page.name }}
{{ page_url(course, page) }}
{{ state_badge(page) }} {{ _('Edit') }} {{ delete_button(url_for('courses.admin_page_delete', page_id=page.id), confirm_form, _('Remove this page?')) }}
{{ _('No pages in this section yet.') }}
{% else %}

{{ _('This course has no sections yet.') }}

{% endfor %} {% if uncategorised %}
{{ _('Outside any section') }}
{{ _('These pages are reachable but are listed on their own. Give them a section to file them.') }}
{% for page in uncategorised %} {% endfor %}
{{ page.name }}
{{ page_url(course, page) }}
{{ state_badge(page) }} {{ _('Edit') }} {{ delete_button(url_for('courses.admin_page_delete', page_id=page.id), confirm_form, _('Remove this page?')) }}
{% endif %} {% endif %} {% endblock %}