From cf647cbe8b68f0388b1fc2f90ee818f31ea651ae Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Tue, 25 Nov 2014 09:18:37 -0200 Subject: [PATCH] Restore the community search for the original --- lib/ext/search_controller.rb | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/lib/ext/search_controller.rb b/lib/ext/search_controller.rb index 5331a2d..d9c61f8 100644 --- a/lib/ext/search_controller.rb +++ b/lib/ext/search_controller.rb @@ -3,35 +3,7 @@ require_dependency 'search_controller' class SearchController def communities - if params[:type] == "Software" - softwares = SoftwareInfo.search(params[:name]) - communities = [] - softwares.each do |s| - communities << s.community - end - results = communities - results = results.paginate(:per_page => 24, :page => params[:page]) - @searches[@asset] = {:results => results} - @search = results - puts "-"*80, @searches - puts "-"*80, @search - elsif params[:type] == "Institution" - institutions = Institution.search_institution(params[:intitution_name]) - puts "="*80, institutions - communities = [] - institutions.each do |s| - communities << s.community - end - results = communities - puts "_"*80, results - results = results.paginate(:per_page => 24, :page => params[:page]) - puts "-="*80, results - @searches[@asset] = {:results => results} - @search = results - puts "="*80, @searches - puts "="*80, @search - else - unfiltered_list = visible_profiles(Community).select{ |com| com.name =~ /#{params[:query]}/} + unfiltered_list = visible_profiles(Community).select{ |com| com.name.downcase =~ /#{params[:query].downcase}/} list_without_software_and_institution = [] unfiltered_list.each do |p| if p.class == Community and !p.software? and !p.institution? @@ -42,6 +14,6 @@ class SearchController results = results.paginate(:per_page => 24, :page => params[:page]) @searches[@asset] = {:results => results} @search = results - end end + end \ No newline at end of file -- libgit2 0.21.2