<table class="table table-hover identity-verifications-list-table">
  <thead class="thead-light">
    <tr>
      <th width="5%">序号</th>
      <th width="5%" class="text-left">昵称</th>
      <th width="10%" class="text-left">仓库</th>
      <th width="5%">站点状态</th>
      <th width="10%" class="text-left">站点名</th>
      <th width="10%" class="text-left">站点标识</th>
      <th width="10%" class="text-left">站点地址</th>

      <th width="5%" class="text-left">建站工具</th>
      <th width="10%" class="text-left">主题</th>
      <th width="10%" class="text-left">上次部署时间</th>
      

      <th width="10%"><%= sort_tag('创建于', name: 'created_at', path: admins_site_pages_path) %></th>
      <th width="10%">操作</th>
    </tr>
  </thead>
  <tbody>
    <% if site_pages.present? %>
      <% site_pages.each_with_index do |site_page, index| %>
        <tr class="identity-verification-item-<%= site_page.id %>">
          <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
          <td class="text-left">
            <%= link_to "/#{site_page.user.login}", target: '_blank' do %>
                <%= overflow_hidden_span site_page.user.real_name, width: 100 %>
            <% end %>
          </td>
          <td class="text-left">
            <%= link_to "/#{site_page.user.login}/#{site_page.project.try(:identifier)}", target: '_blank' do %>
                <%= overflow_hidden_span site_page.project.try(:name), width: 100 %>
            <% end %>
          </td>
          <td><%= display_text(site_page.state == true ? "正常" : "已关闭") %></td>
          <td  style="word-break: break-all;word-wrap: break-word;"><%= display_text(site_page.site_name) %></td>
          <td  style="word-break: break-all;word-wrap: break-word;"><%= display_text(site_page.identifier) %></td>
            <td class="text-left">
            <%= link_to "#{site_page.url}", target: '_blank' do %>
                <%= overflow_hidden_span site_page.url, width: 120 %>
            <% end %>
          </td>
          <td><%= display_text(site_page.language_frame) %></td>
          <td><%= display_text(site_page.theme) %></td>
          <td><%= display_text(site_page.last_build_at&.strftime('%Y-%m-%d %H:%M')) %></td>
          
          <td><%= display_text(site_page.created_at&.strftime('%Y-%m-%d %H:%M')) %></td>
          
          <td class="action-container">
            <%= link_to "查看", edit_admins_site_page_path(site_page), class: 'action' %>
            <%= link_to "删除", admins_site_page_path(site_page), 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: site_pages } %>
