moved all search styling to CSS, removed friendly (but slow) URLs, moved WHERE strings into an array

This commit is contained in:
MrYummy
2017-06-18 13:11:36 -04:00
parent 4619306744
commit d2de01100a
10 changed files with 164 additions and 56 deletions
+21 -23
View File
@@ -7,8 +7,8 @@
<% end %>
<h1>
<%
if params[:id]
text = "forum '#{Forum.find(params[:id]).name}'"
if params[:forum]
text = "forum '#{Forum.find(params[:forum]).name}'"
if params_list.any?
text = "Search results in #{text} (#{@threads.length})"
else
@@ -21,29 +21,27 @@
end
%>
<%= title text %>
<br>
<%= link_to "Advanced Search", search_forumthreads_path(params_list), class: "btn right blue" %>
<% if params_list.any? %>
<% if params[:id] %>
<%= link_to "Show All Threads", forumthreads_path(params_list.except("id")), class: "btn right blue" %>
<% else %>
<%= link_to "Show All Threads", forumthreads_path, class: "btn right blue" %>
<% end %>
<% end %>
<% if params[:id] %>
<%= link_to "Go to Forum", forum_path(params[:id]), class: "btn right blue" %>
<% end %>
</h1>
<div class="searchfield">
<%= form_tag({controller: "forumthreads", action: "index"}, method: :get, enforce_utf8: nil) do %>
<%= text_field_tag "query", params[:query], placeholder: "Search...", style: "width:300px" %>
<% params_list.compact.except("query").each do |key, value| %>
<%= hidden_field_tag key, params[key] %>
<% end %>
<%= submit_tag "Go", class: "searchfield btn", style: "width:40px", name: nil %>
<br>
<%= form_tag(forumthreads_path, method: :get) do %>
<%= text_field_tag "query", params[:query], placeholder: "Search...", class: "searchfield field" %>
<%= submit_tag "Go", class: "searchfield btn" %>
<% params.slice(:title, :content, :reply, :label, :author).each do |key, value| %>
<%= hidden_field_tag key, params[key] %>
<% end %>
</div>
</h1>
<% end %>
<%= link_to "Advanced Search", search_forumthreads_path(params_list), class: "btn right blue" %>
<% if params_list.any? %>
<% if params[:forum] %>
<%= link_to "Show All Threads", forumthreads_path(params_list.except("forum")), class: "btn right blue" %>
<% elsif params_list.except(:controller, :action).any? %>
<%= link_to "Show All Threads", forumthreads_path, class: "btn right blue" %>
<% end %>
<% end %>
<% if params[:forum] %>
<%= link_to "Go to Forum", forum_path(params[:forum]), class: "btn right blue" %>
<% end %>
<div id="forum_groups">
<% @threads.each do |thread| %>
<div class="item-group with-avatar" id="thread-<%= thread.id %>">