Added Necropost Warning
This commit is contained in:
@@ -21,8 +21,12 @@
|
||||
<td><%= f.label :role_write_id, "Min. write role" %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
|
||||
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p><%= f.submit "Update forum", class: "btn blue left" %></p>
|
||||
<% end %>
|
||||
<p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right" %></p>
|
||||
<div class="clear"></div>
|
||||
<div class="clear"></div>
|
||||
|
||||
@@ -21,8 +21,12 @@
|
||||
<td><%= f.label :role_write_id, "Min. write role" %></td>
|
||||
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
|
||||
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<%= f.hidden_field :forumgroup_id %>
|
||||
<p><%= f.submit "Create forum", class: "btn blue left" %></p>
|
||||
<div class="clear"></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,4 +1,17 @@
|
||||
<%= 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 %>
|
||||
<% nec_msg = "" %>
|
||||
<% forum = Forum.find(reply.thread.forum_id) %>
|
||||
<% if forum.necro_length != nil %>
|
||||
<% if Threadreply.where(forumthread: reply.thread).count != 0 %>
|
||||
<% 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 %>
|
||||
|
||||
Reference in New Issue
Block a user