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

{% block title %}课程 - {{ parent() }}{% endblock %}
{% set nav = 'course' %}

{% set bodyClass = 'homepage' %}

{% block content %}
  <p>请创建模版文件customize/content/{{ type }}/list.html.twig，自定义。</p>
  <div class="row es-row-light">



    <div class="col-md-8">

      <div class="panel panel-default panel-primary">
        <div class="panel-heading"><h2>最新文章</h2></div>

        <ul class="media-list content-list article-list">
          {% for content in contents %}
            {% set contentCategory = categories[content.categoryId]|default(null)  %}
            <li class="media">
              {% if content.picture %}
              <a class="pull-right" href="#">
                <img class="media-object" src="{{ file_path(content.picture) }}">
              </a>
              {% endif %}
              <div class="media-body">
                <h4 class="media-heading"><a href="{{ path('content_article_show', {alias:content.alias|default(content.id)}) }}">{{ content.title }}</a></h4>
                {{ content.body|plain_text(120) }}
                <div class="text-muted">
                  <span class="text-muted">发布于 {{ content.publishedTime|date('Y-n-d') }}</span>
                  {% if contentCategory %}
                    <span>, 属于 <a href="#" class="text-muted">{{ contentCategory.name }}</a> 分类</span>
                  {% endif %}
                </div>
              </div>
            </li>
          {% endfor %}
        </ul>

        {{ web_macro.paginator(paginator) }}
      </div>
    </div>

    <div class="col-md-4">
      <div class="panel panel-default">
        <div class="panel-heading">分类</div>

          <div class="list-group list-group-flush">
            {% for category in categoryTree %}
              <a href="{{ path('content_article_list', {categoryId:category.id}) }}" class="list-group-item">{{ category.name }}</a>
              {% endfor  %}
          </div>

      </div>

    </div>
  </div>
{% endblock %}