summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMrYummy <elemental428@gmail.com>2017-06-02 19:25:33 +0200
committerMrYummy <elemental428@gmail.com>2017-06-18 13:11:36 -0400
commitb99e62b7e7de3cc6c020a7a89a9d4066f6b0d797 (patch)
treec9bc4215984a14612cb31ba7717cca2230b9b959
parent0c939f044ccd08dc741f3afaca91dbeb9b0d4b1b (diff)
Removed all trace of search_redirect, included blanks for forum and label filters
-rw-r--r--app/views/forumthreads/search.html.erb16
-rw-r--r--app/views/threadreplies/_new.html.erb2
-rw-r--r--config/routes.rb3
3 files changed, 9 insertions, 12 deletions
diff --git a/app/views/forumthreads/search.html.erb b/app/views/forumthreads/search.html.erb
index a3c631f..6db71a4 100644
--- a/app/views/forumthreads/search.html.erb
+++ b/app/views/forumthreads/search.html.erb
@@ -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 %>
diff --git a/app/views/threadreplies/_new.html.erb b/app/views/threadreplies/_new.html.erb
index 9d716d8..d1fc7d2 100644
--- a/app/views/threadreplies/_new.html.erb
+++ b/app/views/threadreplies/_new.html.erb
@@ -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'." %>
diff --git a/config/routes.rb b/config/routes.rb
index 4db3f30..5b35f95 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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'