From b99e62b7e7de3cc6c020a7a89a9d4066f6b0d797 Mon Sep 17 00:00:00 2001 From: MrYummy Date: Fri, 2 Jun 2017 19:25:33 +0200 Subject: Removed all trace of search_redirect, included blanks for forum and label filters --- app/views/forumthreads/search.html.erb | 16 +++++++--------- app/views/threadreplies/_new.html.erb | 2 +- config/routes.rb | 3 +-- 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 %> -<%= 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") %> - + @@ -48,7 +46,7 @@ <% 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' -- cgit v1.2.3
Forum<%= select_tag "id", options_for_select(["Search All Threads"] + forums, params[:id]) %><%= select_tag "id", options_for_select(forums, params[:id]), include_blank: "Search All Threads" %>
Label - <%= 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" %>
- <%= submit_tag "Go", class: "btn blue", style: "width:50px" %> + <%= submit_tag "Go", class: "btn blue", style: "width:50px", name: nil %>