Commit 6487d6f8a6a8be498b1297c08aad34656161a3ee

Authored by Antonio Terceiro
Committed by Antonio Terceiro
1 parent e891f187

Replacing @finder with @noosfero_finder.

@finder is used internally by GetText
app/controllers/public/search_controller.rb
@@ -22,9 +22,9 @@ class SearchController < PublicController @@ -22,9 +22,9 @@ class SearchController < PublicController
22 22
23 def prepare_filter 23 def prepare_filter
24 if @category 24 if @category
25 - @finder = CategoryFinder.new(@category) 25 + @noosfero_finder = CategoryFinder.new(@category)
26 else 26 else
27 - @finder = EnvironmentFinder.new(@environment) 27 + @noosfero_finder = EnvironmentFinder.new(@environment)
28 end 28 end
29 end 29 end
30 30
@@ -93,7 +93,7 @@ class SearchController < PublicController @@ -93,7 +93,7 @@ class SearchController < PublicController
93 # REFACTOR DUPLICATED CODE inner loop doing the same thing that outter loop 93 # REFACTOR DUPLICATED CODE inner loop doing the same thing that outter loop
94 94
95 if !@query.blank? || @region && !params[:radius].blank? 95 if !@query.blank? || @region && !params[:radius].blank?
96 - @result_ids = @finder.find(asset, @filtered_query, calculate_find_options(asset, nil, params[:page], @product_category, @region, params[:radius], params[:year], params[:month]).merge({:limit => :all})) 96 + @result_ids = @noosfero_finder.find(asset, @filtered_query, calculate_find_options(asset, nil, params[:page], @product_category, @region, params[:radius], params[:year], params[:month]).merge({:limit => :all}))
97 end 97 end
98 98
99 end 99 end
@@ -168,7 +168,7 @@ class SearchController < PublicController @@ -168,7 +168,7 @@ class SearchController < PublicController
168 168
169 where_to_search.select { |key,description| @searching[key] }.each do |key, description| 169 where_to_search.select { |key,description| @searching[key] }.each do |key, description|
170 @order << key 170 @order << key
171 - @results[key] = @finder.find(key, @filtered_query, calculate_find_options(key, limit, params[:page], @product_category, @region, params[:radius], params[:year], params[:month])) 171 + @results[key] = @noosfero_finder.find(key, @filtered_query, calculate_find_options(key, limit, params[:page], @product_category, @region, params[:radius], params[:year], params[:month]))
172 @names[key] = getterm(description) 172 @names[key] = getterm(description)
173 end 173 end
174 174
@@ -203,13 +203,13 @@ class SearchController &lt; PublicController @@ -203,13 +203,13 @@ class SearchController &lt; PublicController
203 @order = [] 203 @order = []
204 @names = {} 204 @names = {}
205 [ 205 [
206 - [ :people, _('People'), @finder.recent('people', limit) ],  
207 - [ :enterprises, __('Enterprises'), @finder.recent('enterprises', limit) ],  
208 - [ :products, _('Products'), @finder.recent('products', limit) ],  
209 - [ :events, _('Upcoming events'), @finder.upcoming_events({:per_page => limit}) ],  
210 - [ :communities, __('Communities'), @finder.recent('communities', limit) ],  
211 - [ :most_commented_articles, _('Most commented articles'), @finder.most_commented_articles(limit) ],  
212 - [ :articles, _('Articles'), @finder.recent('text_articles', limit) ] 206 + [ :people, _('People'), @noosfero_finder.recent('people', limit) ],
  207 + [ :enterprises, __('Enterprises'), @noosfero_finder.recent('enterprises', limit) ],
  208 + [ :products, _('Products'), @noosfero_finder.recent('products', limit) ],
  209 + [ :events, _('Upcoming events'), @noosfero_finder.upcoming_events({:per_page => limit}) ],
  210 + [ :communities, __('Communities'), @noosfero_finder.recent('communities', limit) ],
  211 + [ :most_commented_articles, _('Most commented articles'), @noosfero_finder.most_commented_articles(limit) ],
  212 + [ :articles, _('Articles'), @noosfero_finder.recent('text_articles', limit) ]
213 ].each do |key, name, list| 213 ].each do |key, name, list|
214 @order << key 214 @order << key
215 @results[key] = list 215 @results[key] = list
app/helpers/search_helper.rb
@@ -105,7 +105,7 @@ module SearchHelper @@ -105,7 +105,7 @@ module SearchHelper
105 cats += cats.select { |c| c.children_count > 0 }.map(&:children).flatten 105 cats += cats.select { |c| c.children_count > 0 }.map(&:children).flatten
106 product_categories_ids = cats.map(&:id) 106 product_categories_ids = cats.map(&:id)
107 107
108 - counts = @finder.product_categories_count(asset, product_categories_ids, object_ids) 108 + counts = @noosfero_finder.product_categories_count(asset, product_categories_ids, object_ids)
109 109
110 product_categories_menu = ProductCategory.menu_categories(product_category, environment).map do |cat| 110 product_categories_menu = ProductCategory.menu_categories(product_category, environment).map do |cat|
111 hits = counts[cat.id] 111 hits = counts[cat.id]