Commit cf647cbe8b68f0388b1fc2f90ee818f31ea651ae

Authored by Luciano Prestes
1 parent 607bd513
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

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 &#39;search_controller&#39;
3 3 class SearchController
4 4  
5 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 7 list_without_software_and_institution = []
36 8 unfiltered_list.each do |p|
37 9 if p.class == Community and !p.software? and !p.institution?
... ... @@ -42,6 +14,6 @@ class SearchController
42 14 results = results.paginate(:per_page => 24, :page => params[:page])
43 15 @searches[@asset] = {:results => results}
44 16 @search = results
45   - end
46 17 end
  18 +
47 19 end
48 20 \ No newline at end of file
... ...