Removed all trace of search_redirect, included blanks for forum and label filters

This commit is contained in:
MrYummy
2017-06-02 19:25:33 +02:00
parent fdc6ceabb6
commit 49ab2d0778
3 changed files with 9 additions and 12 deletions

View File

@@ -4,24 +4,22 @@
<% label = Label.where(name: params[:label]).first %>
<table>
<tbody>
<%= form_tag({controller: "forumthreads", action: "search_redirect"}, method: :post) do %>
<%= form_tag({controller: "forumthreads", action: "index"}, method: :get, enforce_utf8: false) do %>
<%
forums = []
Forum.all.sort_by{ |f| f.forumgroup && f.forumgroup.position || 0 }.each do |f|
if current_user != nil && current_user.role_id > f.role_read_id.to_i || current_user == nil && f.role_read_id == nil
forums << ["#{f.forumgroup.name} → #{f.name}", f.id] if f.forumgroup
end
Forum.select{|f| f.can_read?(current_user)}.sort_by{ |f| f.forumgroup && f.forumgroup.position || 0 }.each do |f|
forums << ["#{f.forumgroup.name} → #{f.name}", f.id] if f.forumgroup
end
%>
<% label_list = Label.pluck(:name).insert(0, "Label").insert(1, "No Label") %>
<% label_list = Label.pluck(:name).prepend("No Label") %>
<tr>
<td>Forum</td>
<td><%= select_tag "id", options_for_select(["Search All Threads"] + forums, params[:id]) %></td>
<td><%= select_tag "id", options_for_select(forums, params[:id]), include_blank: "Search All Threads" %></td>
</tr>
<tr>
<td>Label</td>
<td>
<%= select_tag "label", options_for_select(label_list, params[:label]), class: "auto-width" %>
<%= select_tag "label", options_for_select(label_list, params[:label]), include_blank: "Label" %>
</td>
</tr>
<tr>
@@ -48,7 +46,7 @@
</tr>
<tr>
<td>
<%= submit_tag "Go", class: "btn blue", style: "width:50px" %>
<%= submit_tag "Go", class: "btn blue", style: "width:50px", name: nil %>
</td>
</tr>
<% end %>

View File

@@ -3,7 +3,7 @@
<% nec_msg = "" %>
<% forum = Forum.find(reply.thread.forum_id) %>
<% if forum.necro_length != nil %>
<% if Threadreply.where(forumthread: reply.thread).count != 0 %>
<% if 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'." %>

View File

@@ -22,12 +22,12 @@ Redstoner::Application.routes.draw do
post 'resend_mail'
get 'edit_notifications'
put 'update_login'
get 'edit_website_settings'
end
collection do
get 'lost_password'
post 'reset_password'
post 'suggestions'
post 'search_redirect'
end
end
@@ -36,7 +36,6 @@ Redstoner::Application.routes.draw do
resources :threadreplies, path: 'replies'
collection do
get 'search'
post 'search_redirect'
end
end
resources :forums, path: '/forums'