<%= link_to "Back to All Listings", internal_listings_path, class: "btn btn-primary float-right" %>

<h2>Edit <%= link_to @classified_listing.title, "/listings/#{@classified_listing.category}/#{@classified_listing.slug}", target: "_blank", rel: "noopener" %></h2>

<%= form_with model: [:internal, @classified_listing], method: :patch do |form| %>
  <div class="form-group">
    <%= form.label :title %>
    <%= form.text_field :title, size: 100, maxlength: 128, class: "form-control" %>
  </div>
  <div class="form-group">
    <%= form.label :body_markdown %>
    <%= form.text_area :body_markdown, cols: 40, rows: 15, maxlength: 400, class: "form-control" %>
  </div>
  <div class="form-group">
    <%= form.label :tag_list %>
    <i style="font-size: 15px;">Comma separated, one space, 8 tags max</i>
    <%= form.text_field :tag_list, value: @classified_listing.cached_tag_list, size: 100, class: "form-control" %>
  </div>
  <div class="form-group">
    <%= form.label :classified_listing_category_id %>
    <%= form.select :classified_listing_category_id, ClassifiedListing.select_options_for_categories %>
  </div>
  <div class="form-check">
    <%= form.check_box :published, checked: @classified_listing.published? %>
    <%= form.label :published %>
  </div>
  <%= form.submit "Update Listing", class: "btn btn-primary float-right" %>
<% end %>
<hr class="mt-5">
<div class="d-flex justify-content-start">
  <%= form_with model: [:internal, @classified_listing], method: :patch do |f| %>
    <input type="hidden" name="classified_listing[action]" value="bump" />
    <%= f.submit "Bump Listing ⏫", class: "btn btn-secondary" %>
  <% end %>
  <%= link_to "Destroy Listing", url_for(action: :destroy, id: @classified_listing.id), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger ml-2" %>
</div>
