Commit 44949dc0253a287cbd2b6dce92d4eee291df33be
1 parent
605f0206
Exists in
master
and in
27 other branches
[search-improvements] Fixes global search in profile search using ajax
Showing
1 changed file
with
4 additions
and
1 deletions
Show diff stats
app/controllers/public/profile_search_controller.rb
| ... | ... | @@ -9,7 +9,10 @@ class ProfileSearchController < PublicController |
| 9 | 9 | @q = params[:q] |
| 10 | 10 | unless @q.blank? |
| 11 | 11 | if params[:where] == 'environment' |
| 12 | - redirect_to :controller => 'search', :query => @q | |
| 12 | + # user is using global search, redirects to the search controller with | |
| 13 | + # the query | |
| 14 | + search_path = url_for(:controller => 'search', :query => @q) | |
| 15 | + request.xhr? ? render(:js => "window.location.href = #{search_path.to_json}") : redirect_to(search_path) | |
| 13 | 16 | else |
| 14 | 17 | @results = find_by_contents(:articles, profile, profile.articles.published, @q, {:per_page => 10, :page => params[:page]})[:results] |
| 15 | 18 | end | ... | ... |