<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="30%">url</th>
      <th width="10%"><%= sort_tag('创建于', name: 'created_at', path: admins_faqs_path) %></th>
      <th width="10%"><%= sort_tag('更新于', name: 'updated_at', path: admins_faqs_path) %></th>
      <th width="25%">操作</th>
    </tr>
  </thead>
  <tbody>
    <% if faqs.present? %>
      <% faqs.each_with_index do |faq, index| %>
        <tr class="user-item-<%= faq.id %>">
          <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
          <td><%= faq.question%></td>
          <td><%= link_to faq.url, target: '_blank' %></td>
          <td><%= display_text(faq.created_at&.strftime('%Y-%m-%d %H:%M')) %></td>
          <td><%= display_text(faq.updated_at&.strftime('%Y-%m-%d %H:%M')) %></td>
          <td class="action-container">
            <%= link_to "编辑", edit_admins_faq_path(faq), remote: true, class: "action" %>
            <%= link_to "删除", admins_faqs_path(faq.id), method: :delete, data:{confirm: "确认删除的吗？"}, class: "delete-project-action" %>
          </td>
        </tr>
      <% end %>
    <% else %>
      <%= render 'admins/shared/no_data_for_table' %>
    <% end %>
  </tbody>
</table>

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