Commit 57c3ba24efd6ee12f03921c475c972fbcd70c781
Committed by
Gabriela Navarro
1 parent
39945e5f
Exists in
master
and in
5 other branches
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>
Showing
6 changed files
with
16 additions
and
13 deletions
Show diff stats
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 < ActiveRecord::Base | @@ -35,8 +35,10 @@ class SoftwareInfo < 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"> |