<table class="table table-hover text-center subject-list-table">
  <thead class="thead-light">
  <tr>
    <th width="5%">序号</th>
    <th width="20%">标题</th>
    <th width="20%">内容</th>
    <th width="20%">url</th>
    <th width="20%">排序等级</th>
    <th width="20%">报名数</th>
    <th width="25%">操作</th>
  </tr>
  </thead>
  <tbody>
  <% if communicates.present? %>
    <% communicates.each_with_index do |c, index| %>
      <tr id="platform-communicate-item-<%= c.id %>">
        <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
        <td><%= c.title %></td>
        <td><%= c.content.present? ? c.content.truncate(50) : "" %></td>
        <td><%= c.url_or_uuid.present? ? c.url_or_uuid.truncate(50) : "" %></td>
        <td><%= c.order_index %></td>
        <td><%= c.tag_field.to_s.include?("活动") ? link_to(c.watchers_count, "/admins/platform_communicates/#{c.id}") : "--"%></td>
        <td class="action-container">
          <%= link_to c.status ? "下架" : "上架", "/admins/platform_communicates/#{c.id}/online_switch.js", style: "#{c.status? ? 'color:#FF6800;' : ''}", method: :post, remote: true%>
          <%= link_to "编辑", edit_admins_platform_communicate_path(c), remote: true, class: "action" %>
          <%= link_to "删除", admins_platform_communicate_path(c), method: :delete, data:{confirm: "确认删除的吗？"}, class: "action" %>
          <%= c.tag_field.to_s.include?("活动") ? link_to("查看报名", "/admins/platform_communicates/#{c.id}") : ""%>
        </td>
      </tr>
    <% end %>
  <% else %>
    <%= render 'admins/shared/no_data_for_table' %>
  <% end %>
  </tbody>
</table>

<%= render partial: 'admins/shared/paginate', locals: { objects: communicates } %>