<div class="modal fade friendly-link-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" ? "新增" : "编辑" %></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
       <%= form_for @friendly_link, url: {controller: "topic/friendly_links", action: "#{type}"}, html: { enctype: 'multipart/form-data' } do |p| %>
        <div class="modal-body">
          <div class="form-group">
            <label>
              标题 <span class="ml10 color-orange mr20">*</span>
            </label>
            <%= p.text_field :title,class: "form-control input-lg",required: true%>
          </div>
          <div class="form-group">
            <label>
              跳转URL
            </label>
            <%= p.text_field :url, class: "form-control",placeholder: ""%>
          </div>
          <div class="form-group">
            <label>
              排序等级 
            </label>
            <%= p.number_field :order_index, class: "form-control",placeholder: "",required: true%>
          </div>
          <div class="logo-item">
            <% logo_img = @friendly_link.image %>
            <% if logo_img.present? %>
              <div class="logo-item-left mr-3 <%= logo_img ? 'has-img' : '' %>" style="width: 200px;">
                <img class="logo-item-img nav-logo-img" src="<%= logo_img %>" style="width: 200px;<%= logo_img.present? ? '' : 'display: none' %>"/>
                <%= file_field_tag(:image, accept: 'image/png,image/jpg,image/jpeg',style: "margin-left: 6px;", 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' : '' %>" style="width: 200px;">
                <img class="logo-item-img nav-logo-img" src="<%= logo_img %>" style="width: 200px;<%= logo_img.present? ? '' : 'display: none' %>"/>
                <%= file_field_tag(:image, accept: 'image/png,image/jpg,image/jpeg',style: "margin-left: 6px;", value: params[:image],required: true) %>
                <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">Banner<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>