Commit 5a1ee775ad6b2a782b5af2713331c7919e3da338
1 parent
44606433
Exists in
master
and in
79 other branches
Fix community filtered search
Showing
1 changed file
with
16 additions
and
11 deletions
Show diff stats
lib/ext/search_controller.rb
@@ -3,17 +3,22 @@ require_dependency 'search_controller' | @@ -3,17 +3,22 @@ require_dependency 'search_controller' | ||
3 | class SearchController | 3 | class SearchController |
4 | 4 | ||
5 | def communities | 5 | def communities |
6 | - unfiltered_list = visible_profiles(Community).select{ |com| com.name.downcase =~ /#{params[:query].downcase}/} | ||
7 | - list_without_software_and_institution = [] | ||
8 | - unfiltered_list.each do |p| | ||
9 | - if p.class == Community and !p.software? and !p.institution? | ||
10 | - list_without_software_and_institution << p | ||
11 | - end | 6 | + unfiltered_list = visible_profiles(Community) |
7 | + unless params[:query].nil? | ||
8 | + unfiltered_list = unfiltered_list.select do |com| | ||
9 | + com.name.downcase =~ /#{params[:query].downcase}/ | ||
12 | end | 10 | end |
13 | - results = list_without_software_and_institution | ||
14 | - results = results.paginate(:per_page => 24, :page => params[:page]) | ||
15 | - @searches[@asset] = {:results => results} | ||
16 | - @search = results | ||
17 | - end | 11 | + end |
18 | 12 | ||
13 | + list_without_software_and_institution = [] | ||
14 | + unfiltered_list.each do |p| | ||
15 | + if p.class == Community and !p.software? and !p.institution? | ||
16 | + list_without_software_and_institution << p | ||
17 | + end | ||
18 | + end | ||
19 | + results = list_without_software_and_institution | ||
20 | + results = results.paginate(:per_page => 24, :page => params[:page]) | ||
21 | + @searches[@asset] = {:results => results} | ||
22 | + @search = results | ||
23 | + end | ||
19 | end | 24 | end |
20 | \ No newline at end of file | 25 | \ No newline at end of file |