{% extends 'my/layout.html.twig' %}

{% block title %}{{ '我的课程'|trans }} - {{ parent() }}{% endblock %}

{% set side_nav = 'my-notes' %}

{% do script(['app/js/my/learn/notebook/index.js']) %}

{% block main %}

  <div class="panel panel-default panel-col">
    <div class="panel-heading">{{ '我的笔记'|trans }}</div>
    <div class="panel-body">
      <ul class="media-list notebook-list" id="notebook-list">
        {% for member in courseMembers if not courses[member.courseId]|default(null) is empty %}
          {% set course = courses[member.courseId]|default(null) %}
          <div class="media">
            <img class="pull-left media-object" src="{{ filepath(course_cover(course, 'large'), 'courseSet.png') }}">
            <div class="media-body">
              <h4 class="media-heading">{{ course.title }}</h4>
              <div class="notebook-metas">
                <span class="notebook-number">{{ '共 %noteNum% 篇笔记'|trans({'%noteNum%':member.noteNum}) }}</span>
              </div>
              <div class="notebook-metas">
                {% if member.noteLastUpdateTime > 0 %}
                  <span class="notebook-time">{{ '最后更新%noteLastUpdateTime%'|trans({'%noteLastUpdateTime%':member.noteLastUpdateTime | smart_time}) }} </span>
                {% endif %}
                <a class="pull-right notebook-go"
                   href="{{ path('my_notebook_show', {courseId: course.id }) }}">{{ '查看笔记'|trans }}</a>
              </div>
            </div>
          </div>
        {% else %}
          <li class="empty">{{ '你还没有写过笔记'|trans }}</li>
        {% endfor %}
      </ul>
      {{ web_macro.paginator(paginator) }}
    </div>
  </div>
{% endblock %}