<div>
  <div class="form_errors_header">
    <% if story.errors.any? %>
      <%= errors_for story %>
    <% elsif !story.errors.any? && story.similar_stories.any? %>
      <div class="flash-notice">
        <h2>Note: This story was already submitted <%= time_ago_in_words_label(story.most_recent_similar.created_at) %></h2>
        <p>
        You can submit it again if the content has changed or warrants new discussion.
        Please post a comment about that to start.
        </p>
      </div>

      <% if defined?(f) %>
        <%= f.hidden_field :seen_previous %>
      <% else %>
        <%= form_with model: story do |f| %>
          <%= f.hidden_field :seen_previous %>
        <% end %>
      <% end %>
    <% end %>

    <% if story.similar_stories.any? %>
      <p>Previous discussions for this story:</p>
      <%= render partial: "stories/similar", locals: { similar: story.similar_stories } %>
    <% end %>
  </div>
</div>
