<table class="table table-hover text-center subject-list-table">
  <thead class="thead-light">
  <tr>
    <th width="5%">序号</th>
    <th width="15%">名称</th>
    <th width="30%">路由</th>
    <th width="20%">标识</th>
    <th width="10%">类型</th>
    <th width="20%"><%= sort_tag('创建时间', name: 'created_at', path: admins_sites_path) %></th>
    <th width="25%">操作</th>
  </tr>
  </thead>
  <tbody>
  <% if sites.present? %>
    <% sites.each_with_index do |site, index| %>
      <tr class="site-item-<%= site.id %>">
        <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
        <td>
          <%= overflow_hidden_span display_text(site.name), width: 150 %>
        </td>
        <td><%= site.url %></td>
        
        <td><%= overflow_hidden_span display_text(site.key), width: 150 %></td>
        <td><%= site.site_type.humanize %></td>
        <td><%= site.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
        <td class="action-container">
        <%= link_to "编辑", edit_admins_site_path(site), remote: true, class: "action" %>
        <%= link_to "删除", admins_site_path(site), method: :delete, data:{confirm: "确认删除的吗？"}, class: "action" %>
        </td>
      </tr>
    <% end %>
  <% else %>
    <%= render 'admins/shared/no_data_for_table' %>
  <% end %>
  </tbody>
</table>

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