{% import 'TopxiaAdminBundle::macro.html.twig' as admin_macro %}
<tr id="thread-table-tr-{{ thread.id }}">
  <td>
  <input name="ID[]" data-role="batch-item" type="checkbox" value="{{thread.id}}"/> {{ thread.id}}
  </td>

  <td style="word-break:break-all;">
    <strong ><a target="_blank" href="{{path('group_thread_show',{id:thread.groupId,threadId:thread.id})}}">{{ thread.title|plain_text(50)}}</a></strong>

    {% if thread.status=='close'%}
          <label class="label label-danger">关闭</label>
    {% endif %}
  </td>

  <td>
    
    {% if thread.isElite %}
      <a href="javascript:;" data-url="{{ path('admin_group_thread_cancel_elite',{threadId:thread.id}) }}" class="promoted-label">
        <span class="label label-success">精</span>
      </a>
    {% else %}
      <a href="javascript:;" data-url="{{ path('admin_group_thread_set_elite',{threadId:thread.id}) }}" class="promoted-label">
        <span class="label label-default">精</span>
      </a>
    {% endif %}
  
    {% if thread.isStick %}
      <a href="javascript:;" data-url="{{ path('admin_group_thread_cancel_stick',{threadId:thread.id}) }}" class="promoted-label">
        <span class="label label-success">顶</span>
      </a>
    {% else %}
      <a href="javascript:;" data-url="{{ path('admin_group_thread_set_stick',{threadId:thread.id}) }}" class="promoted-label">
        <span class="label label-default">顶</span>
    </a>
    {% endif %}
    
  </td>

  <td><a target="_blank" href="{{ path('user_show', {id:owners[thread.userId].id}) }}">
    {{ owners[thread.userId].nickname}}</a>
  </td>

  <td>
    <a target="_blank" href="{{ path('group_show', {id:group[thread.groupId].id}) }}">
    {{ group[thread.groupId].title}}</a>
  </td>

  <td>
    {{ thread.postNum}}
  </td>

  <td>
    {% if thread.status=='open' %}
      正常
    {% else %}
      关闭
    {% endif %}
 
  </td>

  <td>
    <div class="btn-group">
      <a type="button" class="btn btn-default btn-sm" target="_blank" href="{{path('group_thread_show',{id:thread.groupId,threadId:thread.id})}}" {% if thread.status=='close' %}disabled="disabled"{% endif %}>查看</a>
      <button type="button" class="btn btn-default dropdown-toggle btn-sm " data-toggle="dropdown">
        <span class="caret"></span>
        <span class="sr-only">Toggle Dropdown</span>
      </button>
      <ul class="dropdown-menu" role="menu">

        {% if thread.status=='open' %}
          <li><a href="javascript:" class="close-thread" title="关闭话题({{thread.title}})" data-url="{{path('admin_group_thread_close',{threadId:thread.id})}}"><span class="glyphicon glyphicon-off"></span> 关闭话题</a></li>
        {% else %}
          <li><a href="javascript:" class="open-thread" title="开启话题({{thread.title}})" data-url="{{path('admin_group_thread_open',{threadId:thread.id})}}">
            <span class="glyphicon glyphicon-ok"></span> 开启话题</a>
          </li>
          <li><a href="javascript:" class="delete-thread" title="永久删除话题({{thread.title}})" data-url="{{path('admin_group_thread_delete',{threadId:thread.id})}}">
            <span class="glyphicon glyphicon-trash"></span> 永久删除</a>
          </li>
        {% endif %}

      </ul>
    </div>
  </td>
</tr>