<div class="modal fade activity-forum-change-modal" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title"><%= type == "create" ? "新增-#{Topic.type_filter_cn_name(@type)}" : "编辑-#{Topic.type_filter_cn_name(@type)}" %></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <%= form_for @topic, url: { controller: "topics", action: "#{type}" }, html: { enctype: 'multipart/form-data' } do |p| %>
        <div class="modal-body">
          <div class="form-group">
            <label for="type">配置类型：</label>
            <% user_type_options = Topic.group_types_options(params[:topic_type]) %>
            <%= select_tag('topic[type]', options_for_select(user_type_options, @topic.type), class: 'form-control') %>
          </div>
          <div class="form-group">
            <label>
              标题 <span class="ml10 color-orange mr20">*</span>
            </label>
            <input type="hidden" name="topic_type" , value="<%= params[:topic_type] %>"/>
            <%= p.text_field :title, class: "form-control input-lg", required: true %>
          </div>
          <div class="form-group">
            <label>
              跳转地址 <span class="ml10 color-orange mr20">*</span>
            </label>
            <%= p.text_field :url, class: "form-control input-lg", required: true %>
          </div>
          <div class="form-group">
            <label>
              显示位置
            </label>
            <% location_options = [['', ''], ['首页', 'home'], ['竞赛', 'competition'], ['底部', 'footer']] %>
            <%= select_tag('topic[location]', options_for_select(location_options, @topic.location), class: 'form-control') %>
          </div>
          <div class="form-group">
            <label>
              排序等级
            </label>
            <%= p.number_field :order_index, class: "form-control", placeholder: "" %>
          </div>
          <div class="logo-item">
            <% logo_img = @topic.image %>
            <% if logo_img.present? %>
              <div class="logo-item-left mr-3 <%= logo_img ? 'has-img' : '' %>">
                <img class="logo-item-img nav-logo-img" src="<%= logo_img %>" style="<%= logo_img.present? ? '' : 'display: none' %>"/>
                <%= file_field_tag(:image, accept: 'image/png,image/jpg,image/jpeg', style: "opacity: 0", value: params[:image]) %>
                <label for="image" class="logo-item-upload" data-toggle="tooltip" data-title="选择图片"></label>
              </div>
            <% else %>
              <div class="logo-item-left mr-3 <%= logo_img ? 'has-img' : '' %>">
                <img class="logo-item-img nav-logo-img" src="<%= logo_img %>" style="<%= logo_img.present? ? '' : 'display: none' %>"/>
                <%= file_field_tag(:image, accept: 'image/png,image/jpg,image/jpeg', required: true, style: "opacity: 0", value: params[:image]) %>
                <label for="image" class="logo-item-upload" data-toggle="tooltip" data-title="选择图片"></label>
              </div>
            <% end %>
            <div class="logo-item-right">
              <div class="logo-item-title flex-1">logo<span class="ml10 color-orange mr20">*</span></div>
              <div>格式：PNG、JPG</div>
              <div>尺寸：高度38px以内，宽等比例缩放</div>
            </div>
          </div>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
          <%= p.submit "确认", class: "btn btn-primary submit-btn" %>
        </div>
      <% end %>
    </div>
  </div>
</div>