{% import "TopxiaWebBundle::macro.html.twig" as web_macro %}

{% set hasManagePermission = check_class_permission('manage', class) %}

<li id="post-{{ post.id }}" class="thread-post media clearfix">
  {{ web_macro.user_avatar(author, 'pull-left media-object') }}

  {% if hasManagePermission or app.user.id == post.userId %}
  <div class="thread-post-dropdown">
    <a href="javascript:" class="dropdown-toggle text-muted" data-toggle="dropdown"><i class="glyphicon glyphicon-collapse-down"></i></a>
    <ul class="dropdown-menu pull-right">
      <li><a href="{{ path('class_thread_post_edit', {classId:post.classId, threadId:post.threadId, postId:post.id}) }}"><i class="glyphicon glyphicon-edit"></i> 编辑</a></li>
      {% if hasManagePermission %}
        <li><a href="javascript:" data-action="post-delete" data-url="{{ path('class_thread_post_delete', {classId:post.classId, threadId:post.threadId, postId:post.id}) }}" data-for="#post-{{ post.id }}"><i class="glyphicon glyphicon-remove"></i> 删除</a></li>
      {% endif %}
    </ul>
  </div>
  {% endif %}

  <div class="thread-post-body media-body">
    <div class="media-heading">
      <a href="{{ path('user_show', {id:author.id}) }}">{{ author.truename }}</a>
      <span class="bullet">•</span>
      <span class="text-muted">{{ post.createdTime|smart_time }}</span>


    </div>
    <div class="thread-post-content">{{ post.content|raw }}</div>
    
  </div>
</li>