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

{% block title %}{{'已收藏'|trans}} - {{ parent() }}{% endblock %}

{% set tab_nav = 'favorited' %}

{% block main %}
  <style>
    .course-grids .metas{
      position: relative;
      color: #c1c1c1;
      padding:10px;
      text-align:left;
    }

    .course-grids .course-price-widget{
      float:right;
    }
  </style>
  <div class="panel panel-default panel-col">
    <div class="panel-heading">{{'我的课程'|trans}}</span></div>
    <div class="panel-body">
      {% include 'my/learning/course/nav-pill.html.twig' %}

      <ul class="course-grids">
        {% for courseFavorite in courseFavorites if courseFavorite %}

          {% set mode = 'default' %}
          {% if courseFavorite.type == 'course' %}
            {% set course = data('Course',{courseId:courseFavorite.courseId}) %}
            {% set courseSet =  data('CourseSet',{id:courseFavorite.courseSetId}) %}
            {% include 'my/learning/my-course-set-grid.html.twig' %}
          {% elseif courseFavorite.type == 'openCourse' %}
            {% set course = data('OpenCourse',{courseId:courseFavorite.courseId})|default(null) %}
            {% if course %}
              {% include 'open-course/widget/my-open-course-grid.html.twig' %}
            {% endif %}

          {% endif %}
        {% else %}
          <div class="empty">{{'暂无已收藏的课程'|trans}}</div>
        {% endfor %}
      </ul>
    </div>

    <nav class="text-center">
      {{ web_macro.paginator(paginator) }}
    </nav>
  </div>
{% endblock %}