{% extends "base_template.html" %} {% from "courses/admin/_form.html" import flashes, state_badge with context %} {% block title %}{{ _('Pages') }}{% endblock %} {% macro page_row(page, show_course=False) %} {{ page.name }} {% if show_course %}
{{ page.course.name }}{% if page.category %} · {{ page.category.name }}{% endif %}
{% endif %} {{ state_badge(page) }} {{ (page.updated_at or page.created_at) | course_datetime }} {{ _('View') }} {{ _('History') }} {% endmacro %} {% block content %}

{{ _('Pages') }}

{% if course and not term and not across_years %} {{ _('What %(course)s is made of. Adding a page puts it in the section you choose.', course=course.name) }} {% else %} {{ _('Every page in this wiki, most recently edited first.') }} {% endif %}

{{ flashes() }} {# The year comes first because it is the only thing most visits change, and it is a plain GET so a filtered view is a URL somebody can send. #}
{% if term or across_years %} {{ _('Back to this year') }} {% endif %}
{% if not across_years %} {% endif %}
{% if sections %} {# One year, laid out as the course itself is: a section, its pages, and the way to add one to that section without going through a second form. #} {% for category, pages in sections %}
{{ category.name if category else _('Not in any section') }} {{ ngettext('%(num)d page', '%(num)d pages', pages | length) }} {% if category %}{{ state_badge(category) }}{% endif %}
{% if category %} {{ _('New page here') }} {% endif %}
{% if pages %}
{% for page in pages %}{{ page_row(page) }}{% endfor %}
{% else %}
{{ _('Nothing here yet.') }}
{% endif %}
{% endfor %} {% elif course and not term and not across_years %}
{{ _('%(course)s has no sections yet.', course=course.name) }} {{ _('Add its sections first.') }}
{% else %} {# Searching, or looking across every year: the flat list, with the year and section on every row so a result is never ambiguous. #}
{% for page in pages %}{{ page_row(page, show_course=True) }} {% else %} {% endfor %}
{{ _('Page') }} {{ _('State') }} {{ _('Last edited') }} {{ _('Actions') }}
{{ _('No page matches that. Try a shorter word.') }}
{% if pages | length >= 200 %} {# Said out loud rather than truncating in silence: a list that stops at two hundred without saying so reads as "that is all there is". #} {% endif %}
{% endif %} {% endblock %}