From 57c3ba24efd6ee12f03921c475c972fbcd70c781 Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Tue, 10 Feb 2015 16:23:47 -0200 Subject: [PATCH] Fix error in search page of software_info and institution --- lib/ext/search_controller.rb | 11 +++++++---- lib/institution.rb | 6 ++++-- lib/software_info.rb | 6 ++++-- views/search/_full_community.html.erb | 2 +- views/search/institutions.html.erb | 2 -- views/search/software_infos.html.erb | 2 -- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/ext/search_controller.rb b/lib/ext/search_controller.rb index 4d5134f..5632130 100644 --- a/lib/ext/search_controller.rb +++ b/lib/ext/search_controller.rb @@ -138,10 +138,13 @@ class SearchController def prepare_software_infos_category_groups @categories = Category.software_categories.sort{|a, b| a.name <=> b.name} + @categories_groupe_one = [] + @categories_groupe_two = [] - categories_sliced = @categories.each_slice(@categories.count/2) - - @categories_groupe_one = categories_sliced.next - @categories_groupe_two = categories_sliced.next + if @categories && @categories.count > 1 + categories_sliced = @categories.each_slice(@categories.count/2) + @categories_groupe_one = categories_sliced.next + @categories_groupe_two = categories_sliced.next + end end end diff --git a/lib/institution.rb b/lib/institution.rb index e87a773..cfcb317 100644 --- a/lib/institution.rb +++ b/lib/institution.rb @@ -1,7 +1,9 @@ class Institution < ActiveRecord::Base - SEARCH_FILTERS = [] - SEARCH_DISPLAYS = %w[compact] + SEARCH_FILTERS = { + :order => %w[], + :display => %w[compact] + } def self.default_search_display 'compact' diff --git a/lib/software_info.rb b/lib/software_info.rb index 4422577..53ffe13 100644 --- a/lib/software_info.rb +++ b/lib/software_info.rb @@ -35,8 +35,10 @@ class SoftwareInfo < ActiveRecord::Base searchable_fields end - SEARCH_FILTERS = [] - SEARCH_DISPLAYS = %w[full] + SEARCH_FILTERS = { + :order => %w[], + :display => %w[full] + } def self.default_search_display 'full' diff --git a/views/search/_full_community.html.erb b/views/search/_full_community.html.erb index b615f30..ae7487f 100644 --- a/views/search/_full_community.html.erb +++ b/views/search/_full_community.html.erb @@ -2,7 +2,7 @@
  • - <%= profile_image_link community, :portrait, 'div', community.send(@filter + '_label') + show_date(community.created_at) %> + <%= profile_image_link community, :portrait, 'div', community.send(@order + '_label') + show_date(community.created_at) %>
    diff --git a/views/search/institutions.html.erb b/views/search/institutions.html.erb index 1ddf80d..1b33ed2 100644 --- a/views/search/institutions.html.erb +++ b/views/search/institutions.html.erb @@ -2,8 +2,6 @@ <%= render :partial => 'search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> -<%= render :partial => 'results_header' %> - <%= display_results(@searches, @asset) %> <% if params[:display] != 'map' %> <%= pagination_links @searches[@asset][:results] %> diff --git a/views/search/software_infos.html.erb b/views/search/software_infos.html.erb index 6a158ed..79ba045 100644 --- a/views/search/software_infos.html.erb +++ b/views/search/software_infos.html.erb @@ -3,8 +3,6 @@ <%= render :partial => 'mpog_search_form', :locals => { :hint => _("Type words about the %s you're looking for") % @asset.to_s.singularize } %> - <%= render :partial => 'results_header' %> - <%= display_results(@searches, @asset) %>
    -- libgit2 0.21.2