diff options
Diffstat (limited to 'app/views/forumthreads/index.html.erb')
-rw-r--r-- | app/views/forumthreads/index.html.erb | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/app/views/forumthreads/index.html.erb b/app/views/forumthreads/index.html.erb index f41d43d..3a0493b 100644 --- a/app/views/forumthreads/index.html.erb +++ b/app/views/forumthreads/index.html.erb @@ -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 %>"> |