Commit 57c3ba24efd6ee12f03921c475c972fbcd70c781

Authored by Luciano Prestes
Committed by Gabriela Navarro
1 parent 39945e5f

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 138  
139 139 def prepare_software_infos_category_groups
140 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 149 end
147 150 end
... ...
lib/institution.rb
1 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 8 def self.default_search_display
7 9 'compact'
... ...
lib/software_info.rb
... ... @@ -35,8 +35,10 @@ class SoftwareInfo &lt; ActiveRecord::Base
35 35 searchable_fields
36 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 43 def self.default_search_display
42 44 'full'
... ...
views/search/_full_community.html.erb
... ... @@ -2,7 +2,7 @@
2 2 <li class="search-profile-item">
3 3 <div class="search-enterprise-item">
4 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 6 </div>
7 7  
8 8 <div class="search-enterprise-item-column-right">
... ...
views/search/institutions.html.erb
... ... @@ -2,8 +2,6 @@
2 2  
3 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 5 <%= display_results(@searches, @asset) %>
8 6 <% if params[:display] != 'map' %>
9 7 <%= pagination_links @searches[@asset][:results] %>
... ...
views/search/software_infos.html.erb
... ... @@ -3,8 +3,6 @@
3 3  
4 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 6 <%= display_results(@searches, @asset) %>
9 7  
10 8 <div id="software-pagination">
... ...