{% extends 'es-bar/list-content/study-place.html.twig' %}

{% set esBarMenu = 'classroom' %}
{% block myStudyPlace %}

{% if classrooms %}
  <!-- 班级 -->
  <div class="recommend-class-list">
    {% set classroomCount = 15 %}
    {% for classroom in classrooms %}
      {% set classroomCount = loop.length %}
      <div class="class-item">
        <div class="class-img-wrap">
          <a class="class-img" href="{{ path('classroom_show', {id:classroom.id}) }}">
            <img class="img-responsive" src="{{ filepath(classroom.middlePicture, 'classroom.png') }}" alt="{{ classroom.title }}">
          </a>
          <div class="mask">
            <a href="{{ path('classroom_show', {id:classroom.id}) }}" class="btn btn-warning">{{'立即加入'|trans}}</a>
          </div>
        </div>
        <h3><a class="link-dark" href="{{ path('classroom_show', {id:classroom.id}) }}">{{ classroom.title }}</a></h3>
        <div class="metas">{{'共%courseNum%门课程'|trans({'%courseNum%':classroom.courseNum})}}</div>
      </div>
    {% endfor %}
    {% if classroomCount >= 15 %}
      <p class="text-center"><a class="link-dark" href="{{ path('my_classrooms') }}" target="_blank">{{'更多'|trans}}<i class="es-icon es-icon-angledoubleright"></i></a></p>
    {% endif %}
  </div>
{% else %}
  <div class="empty">{{'暂无%name%'|trans({'%name%': setting('classroom.name')|default('班级'|trans)}) }}</div>
{% endif %}
{% endblock %}
