<ul class="task-list task-show">
  {% for key, item in courseItems %}
    {% if item.itemType == 'chapter' and item.type == 'chapter' %}
      <li class="task-item bg-gray-lighter js-task-chapter">
        <i class="es-icon es-icon-menu left-menu">
        </i><span class="title">第{{ item.number }}{{ setting('default.chapter_name')|default('章'|trans) }}: {{ item.title }}</span>
        <i class="right-menu es-icon es-icon-remove js-remove-icon"></i>
      </li>
    {% elseif item.itemType == 'chapter'  and item.type == 'unit' %}
      <li class="task-item color-gray bg-gray-lighter">
        <span class="title">第{{ item.number }}{{ setting('default.part_name')|default('节'|trans) }}: {{ item.title }}</span>
      </li>
    {% elseif  item.itemType == 'task' %}
      {% set task = item %}

      {% set task_lock =  (course.learnMode  == 'lockMode')  and (task.lock  and   task.number != 1) %}
      <li class="task-item task-content {% if task.activityId == activity.id %} active {% endif %} mouse-control">
        <i class="es-icon
          {% if task_lock %}
          es-icon-lock
          {% elseif  not task.result|default(null) %}
          es-icon-undone-check
          {% elseif task.result.status == 'start' %}
          es-icon-doing color-primary
          {% elseif task.result.status == 'finish' %}
          es-icon-iccheckcircleblack24px color-primary
          {% endif %}
          left-menu"
          ></i>

        {% if not task_lock and task.status == 'published' %}
          <a class="title"
             href="{{ path('course_task_show', {id:task.id,courseId:task.courseId}) }}">
            {% if task.isOptional %}<span class="label label-info mrm">选修</span>{% else %}任务{{ task.number }}: {% endif %}{{ task.title }}
          </a>
        {% else %}
          <div class="title"
               data-url="{{ path('course_task_show', {id:task.id,courseId:task.courseId}) }}">
            {% if task.isOptional %}<span class="label label-info mrm">选修</span>{% else %}任务{{ task.number }}: {% endif %}{{ task.title }}
          </div>
        {% endif %}
        {% if task.status != 'published' %}
          <span class="right-menu ">敬请期待</span>
        {% elseif task_lock %}
          <span class="right-menu mouse-leave">{{ task.activity.length|activity_length_format }}
            <i class="es-icon {{ activity_metas(task.activity.mediaType).icon }} ml5"></i>
          </span>
          <span class="right-menu mouse-enter color-warning">任务未解锁</span>
        {% else %}
          <span class="right-menu">{{ task.activity.length|activity_length_format }}
            <i class="es-icon {{ activity_metas(task.activity.mediaType).icon }} ml5" data-toggle="tooltip"
               data-placement="top" title="{{ activity_metas(task.activity.mediaType).name }}任务"></i></span>
        {% endif %}
      </li>
    {% endif %}
  {% endfor %}
</ul>
