{% extends 'TopxiaWebBundle:My:layout.html.twig' %}

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

{% set side_nav = 'notes' %}
{% set script_controller = 'my/notebook-show' %}

{% block main %}
<div class="panel panel-default panel-col">
  <div class="panel-heading">我的笔记</div>
  <div class="panel-body">
    <div class="notebook" id="notebook">
      <div class="notebook-heading">
        <a class="btn btn-default btn-sm pull-right notebook-back-btn" href="{{ path('my_notebooks') }}" >返回</a>
        <img class="notebook-icon" src="{{ default_path('coursePicture',course.largePicture, 'large') }}" />
        《{{ course.title }}》的笔记
      </div>
      <div class="notebook-body">
        {% for note in notes %}
          {% set lesson = lessons[note.lessonId]|default(null) %}
          <div class="notebook-note notebook-note-collapsed">
            <div class="notebook-note-heading">
              {% if lesson %}
                <a href="{{ path('course_learn', {id:note.courseId}) }}#lesson/{{ lesson.id }}" target="_blank">课时{{ lesson.number }}：{{ lesson.title }}</a>
              {% else %}
                <span>该课时已删除</span>
              {% endif %}
              <span class="pull-right notebook-note-length">共{{ note.length }}字</span>
              {% if note.status == 0 %}
                <span class="btn-xs btn-link"><i class="glyphicon glyphicon-lock pull-right"></span></i>
              {% endif %}  
            </div>
            <div class="notebook-note-summary">{{ note.content|plain_text(97) }}</div>
            <div class="notebook-note-body">
                {{ note.content|raw }}

              <div class="notebook-note-actions clearfix">
                <a href="javascript:" data-url="{{ path('my_note_delete', {id:note.id}) }}" class="pull-right notebook-note-delete" title="删除笔记"><span class="glyphicon glyphicon-trash"></span></a>
              </div>
              <div class="notebook-note-collapse-bar"><span class="glyphicon glyphicon-chevron-up"></span></div>
            </div>
          </div>
        {% endfor %}
      </div>
    </div>
  </div>
</div>
{% endblock %}