<div class="classifieds-container">
  <%= form_for(@classified_listing) do |f| %>
    <div class="classified-form-inner">
      <p>
        You can bump your listing for the same price as the original listing
      </p>
      <h2>
        Last Published or Bumped: <%= time_ago_in_words @classified_listing.bumped_at %> ago
      </h2>
      <% if (@classified_listing.bumped_at + 30.days) < Date.today %>
        <h4>
          (Expired <%= time_ago_in_words (@classified_listing.bumped_at + 30.days) %> ago)
        </h4>
      <% else %>
        <h4>
          (Expires in <%= time_ago_in_words (@classified_listing.bumped_at + 30.days) %>)
        </h4>
      <% end %>
      <input type="hidden" name="classified_listing[action]" value="bump" />
      <%= f.submit "Bump Listing", class: "cta cta-main-listing-form" %>
    </div>
  <% end %>
  <%= form_for(@classified_listing) do |f| %>
    <div class="classified-form-inner">
      <h2>
        <em>You can only edit title/body/tags within the first 24 hours of listing or bumping</em>
      </h2>
      <% if @classified_listing.bumped_at > 24.hours.ago %>
        <div class="field">
          <%= f.label "title", "Title" %>
          <%= f.text_field "title", maxlength: 128, placeholder: "128 characters max, plain text" %>
        </div>
        <div class="field">
          <%= f.label "body_markdown", "Body Markdown" %>
          <%= f.text_area "body_markdown", maxlength: 400, placeholder: "400 characters max, 12 line break max, no images allowed" %>
        </div>
        <div class="field">
          <%= f.label "tag_list", "Tags" %>
          <%= f.text_field "tag_list", value: @classified_listing.cached_tag_list, placeholder: "8 tags max, comma separated, no spaces or special characters" %>
        </div>
        <div class="field">
          <%= f.label "location", "Location" %>
          <%= f.text_field "location", maxlength: 32, placeholder: "32 characters max, plain text" %>
        </div>
        <div class="field">
          <%= f.label "contact_via_connect", "Allow Users to Message Me Via In-App Chat (DEV Connect)" %>
          <%= f.check_box "contact_via_connect" %>
        </div>
        <%= f.submit "Update Listings Info", class: "cta cta-main-listing-form" %>
      <% end %>
    </div>
  <% end %>
  <%= form_for(@classified_listing) do |f| %>
    <div class="classified-form-inner">
      <h2>
        Published: <%= @classified_listing.published %>
      </h2>
      <% if @classified_listing.published == false %>
        <%# <input type="hidden" name="classified_listing[action]" value="publish" />
        <%= f.submit "Publish Listing", class: "classified-listings-publish cta-main-listing-form" %>
      <%# <% else %>
        <input type="hidden" name="classified_listing[action]" value="unpublish" />
        <%= f.submit "Unpublish Listing", class: "classified-listings-unpublish cta-main-listing-form" %>
      <% end %>
    </div>
  <% end %>
</div>
