tilde.news/app/views/stories/_form_errors.html.erb

32 lines
1.2 KiB
Plaintext

<div>
<div class="form_errors_header">
<% if story.errors.count == 1 && story.already_posted_recently? %>
<div class="flash-error">
<h2>Error: This story was submitted <%= time_ago_in_words_label(story.most_recent_similar.created_at) %></h2>
</div>
<% elsif story.errors.any? && !story.already_posted_recently? %>
<%= error_messages_for story %>
<% elsif !story.errors.any? && story.already_posted_recently? %>
<div class="flash-notice">
<h2>Note: This story was already submitted <%= time_ago_in_words_label(story.most_recent_similar.created_at) %>, but may be submitted again.</h2>
<p>
If the content has changed or warrants new discussion, you may submit it again.
</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 %>
</div>
<% if story.already_posted_recently? %>
<p>Previous discussions for this story:</p>
<%= render partial: "stories/similar", locals: { similar: story.similar_stories } %>
<% end %>
</div>