<% define_admin_breadcrumbs do %>
  <% add_admin_breadcrumb('竞赛列表', admins_competitions_path) %>
<% end %>

<div class="box mb-5 admin-competition-list-form">
  <div class="d-flex align-items-center w-100">
    <div class="flex-1 d-flex align-items-center">
      <div class="mr-5">
        <% imageExists = File.exist?(disk_filename("Competition", "banner")) %>
        <% imageUrl = imageExists ? '/' + banner_img("Competition") + "?#{Time.now.to_i}" : '' %>
        <span class="mr-3">竞赛主页banner</span>
        <%= image_tag(imageUrl, width: 150, height: 50, class: "preview-image competition-image-banner mr-1", data: { toggle: 'tooltip', title: '点击预览' }) %>
        <%= javascript_void_link imageExists ? '重新上传' : '上传图片', class: 'action upload-competition-image-action', data: { source_id: "banner", source_type: 'Competition', toggle: 'modal', target: '.admin-upload-file-modal' } %>
      </div>

      <div class="mr-5">
        <label for="hot">
          <%= check_box_tag :hot,(@competition_hot ? 1 : 0),@competition_hot,remote:true,data:{toggle:"tooltip",placement:"top"},class:"competitions-hot-select"%>
          <span class="only_view">hot标识（勾选则"在线竞赛"显示hot标识）</span>
        </label>
      </div>
    </div>

    <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-competition-modal' } %>
  </div>
</div>

<div class="box admin-list-container competitions-list-container">
  <%= render partial: 'admins/competitions/shared/list', locals: { competitions: @competitions } %>
</div>

<%= render 'admins/competitions/shared/create_competition_modal' %>
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片' } %>
<%= render partial: 'admins/competitions/shared/import_competition_score_modal' %>