<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="25%">跳转URL</th>
    <th width="25%">显示位置</th>
    <th width="10%">排序等级</th>
    <th width="20%">操作</th>
  </tr>
  </thead>
  <tbody>
  <% if banners.present? %>
    <% banners.each_with_index do |banner, index| %>
      <tr class="banner-item-<%= banner.id %>">
        <td><%= list_index_no((params[:page] || 1).to_i, index) %></td>
        <td><%= banner.title %></td>
        <td><img style="width:150px" src="<%= banner.image %>" /></td>
<!--        <td><a href="<%#= banner.url %>" target="_blank"><%#= banner.url %></a> </td>-->
        <td><%= banner.url %></td>
        <td><%= ["首页","竞赛"][Topic.locations[banner.location]] %></td>
        <td><%= banner.order_index %></td>
        <td class="action-container">
          <%= link_to "编辑", edit_admins_topic_applet_banner_path(banner), remote: true, class: "action" %>
          <%= link_to "删除", admins_topic_applet_banner_path(banner), 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: banners } %>