Commit 57c3ba24efd6ee12f03921c475c972fbcd70c781

Authored by Luciano Prestes
Committed by Gabriela Navarro
1 parent 39945e5f
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

Fix error in search page of software_info and institution

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
lib/ext/search_controller.rb
@@ -138,10 +138,13 @@ class SearchController @@ -138,10 +138,13 @@ class SearchController
138 138
139 def prepare_software_infos_category_groups 139 def prepare_software_infos_category_groups
140 @categories = Category.software_categories.sort{|a, b| a.name <=> b.name} 140 @categories = Category.software_categories.sort{|a, b| a.name <=> b.name}
  141 + @categories_groupe_one = []
  142 + @categories_groupe_two = []
141 143
142 - categories_sliced = @categories.each_slice(@categories.count/2)  
143 -  
144 - @categories_groupe_one = categories_sliced.next  
145 - @categories_groupe_two = categories_sliced.next 144 + if @categories && @categories.count > 1
  145 + categories_sliced = @categories.each_slice(@categories.count/2)
  146 + @categories_groupe_one = categories_sliced.next
  147 + @categories_groupe_two = categories_sliced.next
  148 + end
146 end 149 end
147 end 150 end
lib/institution.rb
1 class Institution < ActiveRecord::Base 1 class Institution < ActiveRecord::Base
2 2
3 - SEARCH_FILTERS = []  
4 - SEARCH_DISPLAYS = %w[compact] 3 + SEARCH_FILTERS = {
  4 + :order => %w[],
  5 + :display => %w[compact]
  6 + }
5 7
6 def self.default_search_display 8 def self.default_search_display
7 'compact' 9 'compact'
lib/software_info.rb
@@ -35,8 +35,10 @@ class SoftwareInfo &lt; ActiveRecord::Base @@ -35,8 +35,10 @@ class SoftwareInfo &lt; ActiveRecord::Base
35 searchable_fields 35 searchable_fields
36 end 36 end
37 37
38 - SEARCH_FILTERS = []  
39 - SEARCH_DISPLAYS = %w[full] 38 + SEARCH_FILTERS = {
  39 + :order => %w[],
  40 + :display => %w[full]
  41 + }
40 42
41 def self.default_search_display 43 def self.default_search_display
42 'full' 44 'full'
views/search/_full_community.html.erb
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <li class="search-profile-item"> 2 <li class="search-profile-item">
3 <div class="search-enterprise-item"> 3 <div class="search-enterprise-item">
4 <div class="search-enterprise-item-column-left"> 4 <div class="search-enterprise-item-column-left">
5 - <%= profile_image_link community, :portrait, 'div', community.send(@filter + '_label') + show_date(community.created_at) %> 5 + <%= profile_image_link community, :portrait, 'div', community.send(@order + '_label') + show_date(community.created_at) %>
6 </div> 6 </div>
7 7
8 <div class="search-enterprise-item-column-right"> 8 <div class="search-enterprise-item-column-right">
views/search/institutions.html.erb
@@ -2,8 +2,6 @@ @@ -2,8 +2,6 @@
2 2
3 <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> 3 <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %>
4 4
5 -<%= render :partial => 'results_header' %>  
6 -  
7 <%= display_results(@searches, @asset) %> 5 <%= display_results(@searches, @asset) %>
8 <% if params[:display] != 'map' %> 6 <% if params[:display] != 'map' %>
9 <%= pagination_links @searches[@asset][:results] %> 7 <%= pagination_links @searches[@asset][:results] %>
views/search/software_infos.html.erb
@@ -3,8 +3,6 @@ @@ -3,8 +3,6 @@
3 3
4 <%= render :partial => 'mpog_search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> 4 <%= render :partial => 'mpog_search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %>
5 5
6 - <%= render :partial => 'results_header' %>  
7 -  
8 <%= display_results(@searches, @asset) %> 6 <%= display_results(@searches, @asset) %>
9 7
10 <div id="software-pagination"> 8 <div id="software-pagination">