<% define_admin_breadcrumbs do %>
  <% add_admin_breadcrumb("#{Topic.type_filter_cn_name(@type)}") %>
<% end %>

<div class="box search-form-container project-list-form">
  <%= form_tag(admins_topics_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
    <%= text_field_tag(:search, params[:search], class: 'form-control col-12 col-md-2 mr-3', placeholder: '标题检索') %>
    <!--    <input type="hidden" name="type", value="<%#=@type %>"/>-->
    <input type="hidden" name="topic_type" , value="<%= params[:topic_type] %>"/>
    <div class="form-group mr-2">
      <label for="type">配置类型：</label>
      <% user_type_options = [['全部', '']] | Topic.group_types_options(params[:topic_type]) %>
      <%= select_tag(:type, options_for_select(user_type_options), class: 'form-control') %>
    </div>
    <div class="form-group mr-2">
      <label for="location">显示位置：</label>
      <% location_options = [['全部', ''], ['首页', 'home'], ['竞赛', 'competition'], ['底部', 'footer']] %>
      <%= select_tag(:location, options_for_select(location_options), class: 'form-control') %>
    </div>
    <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
    <input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
  <% end %>
  <%= link_to "新增", new_admins_topic_path(topic_type: params[:topic_type]), remote: true, class: "btn btn-primary pull-right", "data-disabled-with": "...新增" %>
</div>

<div class="box admin-list-container activity-forum-list-container">
  <% if params[:topic_type].present? %>
    <%= render partial: "admins/topics/list_#{params[:topic_type]}", locals: { topics: @topics } %>
  <% else %>
    <%= render partial: 'admins/topics/list', locals: { topics: @topics } %>
  <% end %>
</div>
<div id="activity-forum-modals">
</div>
