diff options
Diffstat (limited to 'app/views/threadreplies/_new.html.erb')
-rw-r--r-- | app/views/threadreplies/_new.html.erb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/app/views/threadreplies/_new.html.erb b/app/views/threadreplies/_new.html.erb index b0c4b5e..c22463d 100644 --- a/app/views/threadreplies/_new.html.erb +++ b/app/views/threadreplies/_new.html.erb @@ -1,4 +1,19 @@ <%= form_for [reply.thread, reply] do |f| %> <%= render partial: "md_editor", locals: {name: "threadreply[content]", content: reply.content} %> - <p><%= f.submit "Reply#{ ' (Locked)' if reply.thread.locked? }", class: "btn blue" %></p> -<% end %>
\ No newline at end of file + <% nec_msg = "" %> + <% forum = Forum.find(reply.thread.forum_id) %> + <% if forum.necro_length %> + <% if reply.thread.label.try(:name).try(:downcase) == "closed" %> + <% nec_msg = "This thread is closed. Are you sure you want to make this reply? If so, press 'Ok'" %> + <% elsif Threadreply.where(forumthread: reply.thread).any? %> + <% prevAgo = Threadreply.where(forumthread: reply.thread).order(:id).last.created_at %> + <% if prevAgo <= forum.necro_length.days.ago.utc %> + <% nec_msg = "You may be necroposting, as the last reply was made at least #{forum.necro_length} days ago. If you still wish to make this reply, press 'Ok'." %> + <% end %> + <% elsif reply.thread.created_at <= forum.necro_length.days.ago.utc %> + <% nec_msg = "You may be necroposting, as this thread was posted at least #{forum.necro_length} days ago. If you still wish to make this reply, press 'Ok'." %> + <% end %> + <% end %> + <p><%= f.submit "Reply#{ ' (Locked)' if reply.thread.locked? }", class: "btn blue", data: { confirm: nec_msg } %></p> + <% nec_msg = "" %> +<% end %> |