diff --git a/app/controllers/public/search_controller.rb b/app/controllers/public/search_controller.rb index df65f08..db822dd 100644 --- a/app/controllers/public/search_controller.rb +++ b/app/controllers/public/search_controller.rb @@ -89,11 +89,11 @@ class SearchController < ApplicationController def load_product_categories_menu(asset) @results[asset].uniq! @categories_menu = ProductCategory.menu_categories(@product_category, environment).map do |cat| - hits = @finder.count(:products, @filtered_query, calculate_find_options(asset, nil, nil, cat, @region, params[:radius])) + hits = @finder.count(asset, @filtered_query, calculate_find_options(asset, nil, nil, cat, @region, params[:radius])) childs = [] # REFACTOR DUPLICATED CODE inner loop doing the same thing that outter loop childs = cat.children.map do |child| - child_hits = @finder.count(:products, @filtered_query, calculate_find_options(asset, nil, nil, child, @region, params[:radius])) + child_hits = @finder.count(asset, @filtered_query, calculate_find_options(asset, nil, nil, child, @region, params[:radius])) [child, child_hits] end.select{|child, child_hits| child_hits > 0 } [cat, hits, childs] diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 53350e3..f955283 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -39,6 +39,14 @@ module SearchHelper content_tag('div', data[:toggle] + (render :partial => data[:partial]), :class => "map-or-list-search-results #{data[:class]}") end + def display_item_map_info(item) + if item.kind_of?(Profile) + display_profile_info + elsif item.kind_of?(Product) + display_product_info + end + end + def display_profile_info(profile) # FIXME add distance data = '' @@ -67,4 +75,9 @@ module SearchHelper ) end + def pagination_links(collection, options={}) + options = {:prev_label => '« ' + _('Previous'), :next_label => _('Next') + ' »'}.merge(options) + will_paginate(collection, options) + end + end diff --git a/app/views/search/enterprises.rhtml b/app/views/search/enterprises.rhtml index 24713b3..e6479c5 100644 --- a/app/views/search/enterprises.rhtml +++ b/app/views/search/enterprises.rhtml @@ -16,4 +16,6 @@ <%= display_results %> +<%= pagination_links @results[:enterprises] %> +
diff --git a/app/views/search/people.rhtml b/app/views/search/people.rhtml index e359a64..ec51837 100644 --- a/app/views/search/people.rhtml +++ b/app/views/search/people.rhtml @@ -19,9 +19,10 @@ <% end %> - <%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %> <%= display_results %> +<%= pagination_links @results.values.first %> +
diff --git a/app/views/search/products.rhtml b/app/views/search/products.rhtml index d5237b8..bd19a81 100644 --- a/app/views/search/products.rhtml +++ b/app/views/search/products.rhtml @@ -24,19 +24,12 @@ <%= render :partial => 'product_categories_menu', :object => @categories_menu %> -
-
-
-
    <%= render :partial => 'product', :collection => @results[:products] %>
-
-
-
-
+<%= display_results %> <% if @categories_menu %> <% end %> -<%= will_paginate @results[:products], :id => 'products-pagination' %> +<%= will_paginate @results[:products] %>
-- libgit2 0.21.2