{% import "components/ui/v1.html" as ui_v1 %} {% extends "layout/basic.html" %} {% block content %}
{{ ui_v1.page_header(_('结构排序') ~ ': ' ~ cpdoc.title ~ ' / ' ~ vpdoc.version, _('分别调整章的顺序,以及各章内部的节顺序。')) }}

{{ _('章与节') }}

{{ _('拖动手柄或使用移动按钮调整顺序;聚焦手柄后可使用方向键、Home 或 End。节只能在所属章内排序。') }} {{ _('使用移动按钮逐项调整顺序;节只能在所属章内排序。') }}

{% if chapters.length %}{% endif %} {{ _('返回') }}
{% if not chapters.length %} {{ ui_v1.empty_state(_('这个版本还没有章。')) }} {% else %}
    {% for chapter in chapters %}
  1. {{ ui_v1.sortable_handle(_('拖动章以排序') ~ ': ' ~ chapter.title, 'course-package-structure-sort-help', chapters.length > 1, 'nojs--hide') }} {{ ui_v1.sortable_index(loop.index) }}

    {{ chapter.title }}

    {% if chapter.hidden %}{{ ui_v1.badge(_('已隐藏'), tone='warning') }}{% endif %}
    {{ chapter.lessons.length }} {{ _('节') }}
    {{ ui_v1.sortable_action(_('置顶'), _('置顶章') ~ ': ' ~ chapter.title, action='top', disabled=loop.first, button_type='submit', name='move', value={scope:'chapter', id:chapter.id, action:'top'}|json) }} {{ ui_v1.sortable_action(_('上移'), _('上移章') ~ ': ' ~ chapter.title, action='up', disabled=loop.first, button_type='submit', name='move', value={scope:'chapter', id:chapter.id, action:'up'}|json) }} {{ ui_v1.sortable_action(_('下移'), _('下移章') ~ ': ' ~ chapter.title, action='down', disabled=loop.last, button_type='submit', name='move', value={scope:'chapter', id:chapter.id, action:'down'}|json) }} {{ ui_v1.sortable_action(_('置底'), _('置底章') ~ ': ' ~ chapter.title, action='bottom', disabled=loop.last, button_type='submit', name='move', value={scope:'chapter', id:chapter.id, action:'bottom'}|json) }}
    {% if chapter.lessons.length %}
      {% for lesson in chapter.lessons %}
    1. {{ ui_v1.sortable_handle(_('拖动节以排序') ~ ': ' ~ lesson.title, 'course-package-structure-sort-help', chapter.lessons.length > 1, 'nojs--hide') }} {{ ui_v1.sortable_index(loop.index) }}

      {{ lesson.title }}

      {% if lesson.hidden %}{{ ui_v1.badge(_('已隐藏'), tone='warning') }}{% endif %}
      {{ lesson.pids.length }} {{ _('题目') }}
      {{ ui_v1.sortable_action(_('置顶'), _('置顶节') ~ ': ' ~ lesson.title, action='top', disabled=loop.first, button_type='submit', name='move', value={scope:'lesson', chapterId:chapter.id, id:lesson.id, action:'top'}|json) }} {{ ui_v1.sortable_action(_('上移'), _('上移节') ~ ': ' ~ lesson.title, action='up', disabled=loop.first, button_type='submit', name='move', value={scope:'lesson', chapterId:chapter.id, id:lesson.id, action:'up'}|json) }} {{ ui_v1.sortable_action(_('下移'), _('下移节') ~ ': ' ~ lesson.title, action='down', disabled=loop.last, button_type='submit', name='move', value={scope:'lesson', chapterId:chapter.id, id:lesson.id, action:'down'}|json) }} {{ ui_v1.sortable_action(_('置底'), _('置底节') ~ ': ' ~ lesson.title, action='bottom', disabled=loop.last, button_type='submit', name='move', value={scope:'lesson', chapterId:chapter.id, id:lesson.id, action:'bottom'}|json) }}
    2. {% endfor %}
    {% else %}
    {{ ui_v1.empty_state(_('本章还没有节。')) }}
    {% endif %}
  2. {% endfor %}
{% endif %}

{% endblock %}