{% if app.user %}
<div class="media">
  <a class="pull-left" href="javascript:">
    <img class="media-object media-object-small" src="{{ filepath(app.user.smallAvatar, 'avatar.png') }}">
  </a>
  <div class="media-body">
    <form class="comment-widget-form" action="{{ path('comment_widget_create') }}" method="post">
      <div>{{ form_widget(form.content, {attr:{class:'mbm', style:'width:100%'}}) }}</div>
      <button class="btn btn-primary mbl comment-widget-create-btn" type="submit">发表</button>
      {{ form_rest(form) }}
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
  </div>
</div>
{% else %}
  <p class="alert text-muted">您尚未登录，不能评论，请先 <a href="{{ path('login') }}">登录</a> 或 <a href="{{ path('register') }}">注册</a> 。</p>
{% endif %}

<ul class="media-list comment-list">
  {% for comment in comments %}
    {% set user = users[comment.userId] %}
    {% include 'TopxiaWebBundle:CommentWidget:item.html.twig' %}
  {% endfor %}
</ul>