Commit cf647cbe8b68f0388b1fc2f90ee818f31ea651ae
1 parent
607bd513
Exists in
master
and in
5 other branches
Restore the community search for the original
Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
1 changed file
with
2 additions
and
30 deletions
Show diff stats
lib/ext/search_controller.rb
| @@ -3,35 +3,7 @@ require_dependency 'search_controller' | @@ -3,35 +3,7 @@ require_dependency 'search_controller' | ||
| 3 | class SearchController | 3 | class SearchController |
| 4 | 4 | ||
| 5 | def communities | 5 | def communities |
| 6 | - if params[:type] == "Software" | ||
| 7 | - softwares = SoftwareInfo.search(params[:name]) | ||
| 8 | - communities = [] | ||
| 9 | - softwares.each do |s| | ||
| 10 | - communities << s.community | ||
| 11 | - end | ||
| 12 | - results = communities | ||
| 13 | - results = results.paginate(:per_page => 24, :page => params[:page]) | ||
| 14 | - @searches[@asset] = {:results => results} | ||
| 15 | - @search = results | ||
| 16 | - puts "-"*80, @searches | ||
| 17 | - puts "-"*80, @search | ||
| 18 | - elsif params[:type] == "Institution" | ||
| 19 | - institutions = Institution.search_institution(params[:intitution_name]) | ||
| 20 | - puts "="*80, institutions | ||
| 21 | - communities = [] | ||
| 22 | - institutions.each do |s| | ||
| 23 | - communities << s.community | ||
| 24 | - end | ||
| 25 | - results = communities | ||
| 26 | - puts "_"*80, results | ||
| 27 | - results = results.paginate(:per_page => 24, :page => params[:page]) | ||
| 28 | - puts "-="*80, results | ||
| 29 | - @searches[@asset] = {:results => results} | ||
| 30 | - @search = results | ||
| 31 | - puts "="*80, @searches | ||
| 32 | - puts "="*80, @search | ||
| 33 | - else | ||
| 34 | - unfiltered_list = visible_profiles(Community).select{ |com| com.name =~ /#{params[:query]}/} | 6 | + unfiltered_list = visible_profiles(Community).select{ |com| com.name.downcase =~ /#{params[:query].downcase}/} |
| 35 | list_without_software_and_institution = [] | 7 | list_without_software_and_institution = [] |
| 36 | unfiltered_list.each do |p| | 8 | unfiltered_list.each do |p| |
| 37 | if p.class == Community and !p.software? and !p.institution? | 9 | if p.class == Community and !p.software? and !p.institution? |
| @@ -42,6 +14,6 @@ class SearchController | @@ -42,6 +14,6 @@ class SearchController | ||
| 42 | results = results.paginate(:per_page => 24, :page => params[:page]) | 14 | results = results.paginate(:per_page => 24, :page => params[:page]) |
| 43 | @searches[@asset] = {:results => results} | 15 | @searches[@asset] = {:results => results} |
| 44 | @search = results | 16 | @search = results |
| 45 | - end | ||
| 46 | end | 17 | end |
| 18 | + | ||
| 47 | end | 19 | end |
| 48 | \ No newline at end of file | 20 | \ No newline at end of file |