Commit e6d5780d179d61cff097447d86196875a7730409
1 parent
83c7d50d
Exists in
master
and in
29 other branches
Search refactoring
- Start search refactoring to a action based controller, like the BrowseController - Region, city and other advanced options removed in favor of facets - Add search contents menu Contents (or Articles) like people one. - Removed browse controller and views. They will unified with the refactored search controller and views. - Initial category search changes, see subsequent commits
Showing
23 changed files
with
313 additions
and
326 deletions
Show diff stats
app/controllers/public/search_controller.rb
1 | class SearchController < PublicController | 1 | class SearchController < PublicController |
2 | 2 | ||
3 | helper TagsHelper | 3 | helper TagsHelper |
4 | + include SearchHelper | ||
4 | 5 | ||
5 | before_filter :load_category | 6 | before_filter :load_category |
6 | - before_filter :prepare_filter | ||
7 | before_filter :check_search_whole_site | 7 | before_filter :check_search_whole_site |
8 | before_filter :load_search_assets | 8 | before_filter :load_search_assets |
9 | - before_filter :check_valid_assets, :only => [ :assets ] | ||
10 | 9 | ||
11 | no_design_blocks | 10 | no_design_blocks |
12 | 11 | ||
13 | - protected | 12 | + def articles |
13 | + @asset = :articles | ||
14 | + @query = params[:query] || '' | ||
15 | + @order ||= [@asset] | ||
16 | + @results ||= {} | ||
17 | + @filter = filter | ||
18 | + | ||
19 | + pg_options = paginate_options(@asset, limit, params[:per_page]) | ||
20 | + if !@query.blank? | ||
21 | + ret = asset_class(@asset).find_by_contents(@query, pg_options, solr_options(@asset, params[:facet], params[:order_by])) | ||
22 | + @results[@asset] = ret[:results] | ||
23 | + @facets = ret[:facets] | ||
24 | + else | ||
25 | + @results[@asset] = asset_class(@asset).send('paginate', :all, pg_options) | ||
26 | + @facets = {} | ||
27 | + end | ||
28 | + end | ||
14 | 29 | ||
15 | - def load_search_assets | ||
16 | - @search_in = where_to_search | ||
17 | - @searching = {} | ||
18 | - @search_in.each do |key, name| | ||
19 | - @searching[key] = (params[:asset].blank? && (params[:find_in].nil? || params[:find_in].empty? || params[:find_in].include?(key.to_s))) || (params[:asset] == key.to_s) | 30 | + alias :contents :articles |
31 | + | ||
32 | + def people | ||
33 | + @asset = :people | ||
34 | + @query = params[:query] || '' | ||
35 | + @order ||= [@asset] | ||
36 | + @results ||= {} | ||
37 | + @filter = filter | ||
38 | + @title = self.filter_description(params[:action] + '_' + @filter ) | ||
39 | + | ||
40 | + @results[@asset] = @environment.people.visible.send(@filter) | ||
41 | + if !@query.blank? | ||
42 | + ret = @results[@asset].find_by_contents(@query, {}, solr_options(@asset, params[:facet], params[:order_by])) | ||
43 | + @results[@asset] = ret[:results] | ||
44 | + @facets = ret[:facets] | ||
45 | + else | ||
46 | + @facets = {} | ||
20 | end | 47 | end |
48 | + @results[@asset] = @results[@asset].compact.paginate(:per_page => limit, :page => params[:page]) | ||
21 | end | 49 | end |
22 | 50 | ||
23 | - def prepare_filter | ||
24 | - if @category | ||
25 | - @noosfero_finder = CategoryFinder.new(@category) | 51 | + def products |
52 | + @asset = :products | ||
53 | + @query = params[:query] || '' | ||
54 | + @order ||= [@asset] | ||
55 | + @results ||= {} | ||
56 | + | ||
57 | + pg_options = paginate_options(@asset, limit, params[:per_page]) | ||
58 | + if !@query.blank? | ||
59 | + ret = asset_class(@asset).find_by_contents(@query, pg_options, solr_options(@asset, params[:facet], params[:order_by])) | ||
60 | + @results[@asset] = ret[:results] | ||
61 | + @facets = ret[:facets] | ||
26 | else | 62 | else |
27 | - @noosfero_finder = EnvironmentFinder.new(@environment) | 63 | + @results[@asset] = asset_class(@asset).send('paginate', :all, pg_options) |
64 | + @facets = {} | ||
28 | end | 65 | end |
29 | end | 66 | end |
30 | 67 | ||
31 | - def check_search_whole_site | ||
32 | - if params[:search_whole_site_yes] or params[:search_whole_site] == 'yes' | ||
33 | - redirect_to params.merge(:category_path => [], :search_whole_site => nil, :search_whole_site_yes => nil) | 68 | + def enterprises |
69 | + @asset = :enterprises | ||
70 | + @query = params[:query] || '' | ||
71 | + @order ||= [@asset] | ||
72 | + @results ||= {} | ||
73 | + | ||
74 | + pg_options = paginate_options(@asset, limit, params[:per_page]) | ||
75 | + if !@query.blank? | ||
76 | + ret = asset_class(@asset).find_by_contents(@query, pg_options, solr_options(@asset, params[:facet], params[:order_by])) | ||
77 | + @results[@asset] = ret[:results] | ||
78 | + @facets = ret[:facets] | ||
79 | + else | ||
80 | + @results[@asset] = asset_class(@asset).send('paginate', :all, pg_options) | ||
81 | + @facets = {} | ||
34 | end | 82 | end |
35 | end | 83 | end |
36 | 84 | ||
37 | - def check_valid_assets | ||
38 | - @asset = params[:asset].to_sym | ||
39 | - if !where_to_search.map(&:first).include?(@asset) | ||
40 | - render :text => 'go away', :status => 403 | ||
41 | - return | 85 | + def communities |
86 | + @asset = :communities | ||
87 | + @query = params[:query] || '' | ||
88 | + @order ||= [@asset] | ||
89 | + @results ||= {} | ||
90 | + @filter = filter | ||
91 | + @title = self.filter_description(params[:action] + '_' + @filter ) | ||
92 | + | ||
93 | + @results[@asset] = @environment.communities.visible.send(@filter) | ||
94 | + if !@query.blank? | ||
95 | + ret = @results[@asset].find_by_contents(@query, {}, solr_options(@asset, params[:facet], params[:order_by])) | ||
96 | + @results[@asset] = ret[:results] | ||
97 | + @facets = ret[:facets] | ||
98 | + else | ||
99 | + @facets = {} | ||
42 | end | 100 | end |
101 | + @results[@asset] = @results[@asset].compact.paginate(:per_page => limit, :page => params[:page]) | ||
43 | end | 102 | end |
44 | 103 | ||
45 | def events | 104 | def events |
105 | + @asset = :events | ||
106 | + params[:asset] |= [@asset] | ||
107 | + @query = params[:query] || '' | ||
108 | + @order ||= [@asset] | ||
109 | + @results ||= {} | ||
46 | @category_id = @category ? @category.id : nil | 110 | @category_id = @category ? @category.id : nil |
47 | 111 | ||
112 | + if params[:year] || params[:month] | ||
113 | + date = Date.new(year.to_i, month.to_i, 1) | ||
114 | + date_range = (date - 1.month)..(date + 1.month).at_end_of_month | ||
115 | + end | ||
116 | + | ||
117 | + if @query.blank? | ||
118 | + # Ignore pagination for asset events | ||
119 | + if date_range | ||
120 | + @results[@asset] = Event.send('find', :all, | ||
121 | + :conditions => [ | ||
122 | + 'start_date BETWEEN :start_day AND :end_day OR end_date BETWEEN :start_day AND :end_day', | ||
123 | + {:start_day => date_range.first, :end_day => date_range.last} | ||
124 | + ]) | ||
125 | + else | ||
126 | + @results[@asset] = Event.send('find', :all) | ||
127 | + end | ||
128 | + else | ||
129 | + pg_options = paginate_options(@asset, limit, params[:per_page]) | ||
130 | + solr_options = solr_options(@asset, params[:facet], params[:per_page]) | ||
131 | + @results[@asset] = Event.find_by_contents(@query, pg_options, solr_options)[:results] | ||
132 | + end | ||
133 | + | ||
48 | @selected_day = nil | 134 | @selected_day = nil |
49 | @events_of_the_day = [] | 135 | @events_of_the_day = [] |
50 | date = build_date(params[:year], params[:month], params[:day]) | 136 | date = build_date(params[:year], params[:month], params[:day]) |
@@ -58,125 +144,24 @@ class SearchController < PublicController | @@ -58,125 +144,24 @@ class SearchController < PublicController | ||
58 | end | 144 | end |
59 | end | 145 | end |
60 | 146 | ||
61 | - events = @results[:events] | ||
62 | - | 147 | + events = @results[@asset] |
63 | @calendar = populate_calendar(date, events) | 148 | @calendar = populate_calendar(date, events) |
64 | @previous_calendar = populate_calendar(date - 1.month, events) | 149 | @previous_calendar = populate_calendar(date - 1.month, events) |
65 | @next_calendar = populate_calendar(date + 1.month, events) | 150 | @next_calendar = populate_calendar(date + 1.month, events) |
66 | end | 151 | end |
67 | 152 | ||
68 | - def people | ||
69 | - #nothing, just to enable | ||
70 | - end | ||
71 | - def enterprises | ||
72 | - load_product_categories_menu(:enterprises) | ||
73 | - @categories_menu = true | ||
74 | - end | ||
75 | - def communities | ||
76 | - #nothing, just to enable | ||
77 | - end | ||
78 | - def articles | ||
79 | - #nothins, just to enable | ||
80 | - end | ||
81 | - | ||
82 | - def products | ||
83 | - load_product_categories_menu(:products) | ||
84 | - @categories_menu = true | ||
85 | - end | ||
86 | - | ||
87 | - def load_product_categories_menu(asset) | ||
88 | - @results[asset].uniq! | ||
89 | - # REFACTOR DUPLICATED CODE inner loop doing the same thing that outter loop | ||
90 | - | ||
91 | - if !@query.blank? || @region && !params[:radius].blank? | ||
92 | - ret = @noosfero_finder.find(asset, @query, calculate_find_options(asset, nil, params[:page], @product_category, @region, params[:radius], params[:year], params[:month], params[:order_by]).merge({:limit => :all})) | ||
93 | - @result_ids = ret.is_a?(Hash) ? ret[:results] : ret | ||
94 | - end | ||
95 | - | ||
96 | - end | ||
97 | - | ||
98 | - def calculate_find_options(asset, limit, page, product_category, region, radius, year, month, solr_order) | ||
99 | - result = { :product_category => product_category, :per_page => limit, :page => page } | ||
100 | - if [:enterprises, :people, :products].include?(asset) && region | ||
101 | - result.merge!(:within => radius, :region => region.id) | ||
102 | - end | ||
103 | - | ||
104 | - if month || year | ||
105 | - date = Date.new(year.to_i, month.to_i, 1) | ||
106 | - result[:date_range] = (date - 1.month)..(date + 1.month).at_end_of_month | ||
107 | - end | ||
108 | - | ||
109 | - if asset_class(asset).methods.include?('facets') | ||
110 | - result.merge!(:facets => {:zeros => false, :sort => :count, :fields => asset_class(asset).facets.keys, | ||
111 | - :browse => params[:facet] ? params[:facet].map{ |k,v| k.to_s+':"'+v.to_s+'"'} : ''}) | ||
112 | - end | ||
113 | - | ||
114 | - result[:order_by] = solr_order | ||
115 | - | ||
116 | - result | ||
117 | - end | ||
118 | - | ||
119 | - # limit the number of results per page | ||
120 | - # TODO: dont hardcore like this | ||
121 | - def limit | ||
122 | - searching = @searching.values.select{|v|v} | ||
123 | - if params[:display] == 'map' | ||
124 | - 2000 | ||
125 | - else | ||
126 | - (searching.size == 1) ? 20 : 6 | ||
127 | - end | ||
128 | - end | ||
129 | - | ||
130 | - public | ||
131 | - | ||
132 | - include SearchHelper | ||
133 | - | ||
134 | - ###################################################### | ||
135 | - | ||
136 | - def where_to_search | ||
137 | - [ | ||
138 | - [ :articles, N_('Articles') ], | ||
139 | - [ :enterprises, N_('Enterprises') ], | ||
140 | - [ :people, N_('People') ], | ||
141 | - [ :communities, N_('Communities') ], | ||
142 | - [ :products, N_('Products') ], | ||
143 | - [ :events, N_('Events') ] | ||
144 | - ].select {|key, name| !environment.enabled?('disable_asset_' + key.to_s) } | ||
145 | - end | ||
146 | - | ||
147 | - def cities | ||
148 | - @cities = City.find(:all, :order => 'name', :conditions => ['parent_id = ? and lat is not null and lng is not null', params[:state_id]]) | ||
149 | - render :action => 'cities', :layout => false | ||
150 | - end | ||
151 | - | ||
152 | - def complete_region | ||
153 | - # FIXME this logic should be in the model | ||
154 | - @regions = Region.find(:all, :conditions => [ '(name like ? or name like ?) and lat is not null and lng is not null', '%' + params[:region][:name] + '%', '%' + params[:region][:name].capitalize + '%' ]) | ||
155 | - render :action => 'complete_region', :layout => false | ||
156 | - end | ||
157 | - | ||
158 | def index | 153 | def index |
159 | - @query = params[:query] || '' | ||
160 | - @product_category = ProductCategory.find(params[:product_category]) if params[:product_category] | ||
161 | - | ||
162 | - @region = City.find_by_id(params[:city]) if !params[:city].blank? && params[:city] =~ /^\d+$/ | ||
163 | - | ||
164 | - # how many assets we are searching for? | ||
165 | - number_of_result_assets = @searching.values.select{|v| v}.size | ||
166 | - | ||
167 | @results = {} | 154 | @results = {} |
168 | - @facets = {} | ||
169 | @order = [] | 155 | @order = [] |
170 | @names = {} | 156 | @names = {} |
171 | 157 | ||
172 | where_to_search.select { |key,description| @searching[key] }.each do |key, description| | 158 | where_to_search.select { |key,description| @searching[key] }.each do |key, description| |
159 | + send(key) | ||
173 | @order << key | 160 | @order << key |
174 | - find_options = calculate_find_options(key, limit, params[:page], @product_category, @region, params[:radius], params[:year], params[:month], params[:order_by]); | ||
175 | - ret = @noosfero_finder.find(key, @query, find_options) | ||
176 | - @results[key] = ret.is_a?(Hash) ? ret[:results] : ret | ||
177 | - @facets[key] = ret.is_a?(Hash) ? ret[:facets] : {} | ||
178 | @names[key] = getterm(description) | 161 | @names[key] = getterm(description) |
179 | end | 162 | end |
163 | + @asset = nil | ||
164 | + @facets = {} | ||
180 | 165 | ||
181 | if @results.keys.size == 1 | 166 | if @results.keys.size == 1 |
182 | specific_action = @results.keys.first | 167 | specific_action = @results.keys.first |
@@ -187,34 +172,76 @@ class SearchController < PublicController | @@ -187,34 +172,76 @@ class SearchController < PublicController | ||
187 | return | 172 | return |
188 | end | 173 | end |
189 | end | 174 | end |
190 | - | ||
191 | - render :action => 'index' | ||
192 | end | 175 | end |
193 | 176 | ||
194 | alias :assets :index | 177 | alias :assets :index |
195 | 178 | ||
196 | - ####################################################### | ||
197 | - | ||
198 | # view the summary of one category | 179 | # view the summary of one category |
199 | def category_index | 180 | def category_index |
200 | @results = {} | 181 | @results = {} |
201 | @order = [] | 182 | @order = [] |
202 | @names = {} | 183 | @names = {} |
203 | [ | 184 | [ |
204 | - [ :people, _('People'), @noosfero_finder.recent('people', limit) ], | ||
205 | - [ :enterprises, __('Enterprises'), @noosfero_finder.recent('enterprises', limit) ], | ||
206 | - [ :products, _('Products'), @noosfero_finder.recent('products', limit) ], | ||
207 | - [ :events, _('Upcoming events'), @noosfero_finder.upcoming_events({:per_page => limit}) ], | ||
208 | - [ :communities, __('Communities'), @noosfero_finder.recent('communities', limit) ], | ||
209 | - [ :most_commented_articles, _('Most commented articles'), @noosfero_finder.most_commented_articles(limit) ], | ||
210 | - [ :articles, _('Articles'), @noosfero_finder.recent('text_articles', limit) ] | 185 | + [ :people, _('People'), recent('people') ], |
186 | + [ :enterprises, __('Enterprises'), recent('enterprises') ], | ||
187 | + [ :products, _('Products'), recent('products') ], | ||
188 | + [ :events, _('Upcoming events'), upcoming_events({:per_page => limit}) ], | ||
189 | + [ :communities, __('Communities'), recent('communities', limit) ], | ||
190 | + [ :most_commented_articles, _('Most commented articles'), most_commented_articles(limit) ], | ||
191 | + [ :articles, _('Articles'), recent('text_articles', limit) ] | ||
211 | ].each do |key, name, list| | 192 | ].each do |key, name, list| |
212 | @order << key | 193 | @order << key |
213 | @results[key] = list | 194 | @results[key] = list |
214 | @names[key] = name | 195 | @names[key] = name |
215 | end | 196 | end |
197 | + @facets = {} | ||
198 | + end | ||
199 | + | ||
200 | + protected | ||
201 | + | ||
202 | + def recent(asset, limit = nil) | ||
203 | + find(asset, nil, :limit => limit, :order => 'created_at DESC, id DESC') | ||
204 | + end | ||
205 | + | ||
206 | + def most_commented_articles(limit=10, options={}) | ||
207 | + options = {:page => 1, :per_page => limit, :order => 'comments_count DESC'}.merge(options) | ||
208 | + Article.paginate(:all, options_for_find(Article, options)) | ||
209 | + end | ||
210 | + | ||
211 | + def upcoming_events(options = {}) | ||
212 | + options.delete(:page) | ||
213 | + options.delete(:per_page) | ||
214 | + | ||
215 | + Event.find(:all, {:include => :categories, :conditions => [ 'categories.id = ? and start_date >= ?', category_id, Date.today ], :order => 'start_date' }.merge(options)) | ||
216 | end | 216 | end |
217 | + | ||
218 | + | ||
217 | attr_reader :category | 219 | attr_reader :category |
220 | + attr_reader :category_id | ||
221 | + | ||
222 | + def load_category | ||
223 | + unless params[:category_path].blank? | ||
224 | + path = params[:category_path].join('/') | ||
225 | + @category = environment.categories.find_by_path(path) | ||
226 | + if @category.nil? | ||
227 | + render_not_found(path) | ||
228 | + end | ||
229 | + @category_id = @category.id | ||
230 | + end | ||
231 | + end | ||
232 | + | ||
233 | + def where_to_search | ||
234 | + [ | ||
235 | + [ :articles, N_('Articles') ], | ||
236 | + [ :enterprises, N_('Enterprises') ], | ||
237 | + [ :people, N_('People') ], | ||
238 | + [ :communities, N_('Communities') ], | ||
239 | + [ :products, N_('Products') ], | ||
240 | + [ :events, N_('Events') ] | ||
241 | + ].select {|key, name| !environment.enabled?('disable_asset_' + key.to_s) } | ||
242 | + end | ||
243 | + | ||
244 | + ####################################################### | ||
218 | 245 | ||
219 | def tags | 246 | def tags |
220 | @tags_cache_key = "tags_env_#{environment.id.to_s}" | 247 | @tags_cache_key = "tags_env_#{environment.id.to_s}" |
@@ -248,4 +275,90 @@ class SearchController < PublicController | @@ -248,4 +275,90 @@ class SearchController < PublicController | ||
248 | render :partial => 'events/events_by_day' | 275 | render :partial => 'events/events_by_day' |
249 | end | 276 | end |
250 | 277 | ||
278 | + def current_events(year, month, options={}) | ||
279 | + options.delete(:page) | ||
280 | + options.delete(:per_page) | ||
281 | + | ||
282 | + range = Event.date_range(year, month) | ||
283 | + | ||
284 | + Event.find(:all, {:include => :categories, :conditions => { 'categories.id' => category_id, :start_date => range }}.merge(options)) | ||
285 | + end | ||
286 | + | ||
287 | + def filter | ||
288 | + if FILTERS.include?(params[:filter]) | ||
289 | + params[:filter] | ||
290 | + else | ||
291 | + 'more_recent' | ||
292 | + end | ||
293 | + end | ||
294 | + | ||
295 | + def filter_description(str) | ||
296 | + { | ||
297 | + 'contents_more_recent' => _('More recent contents'), | ||
298 | + 'contents_more_popular' => _('More popular contents'), | ||
299 | + 'people_more_recent' => _('More recent people'), | ||
300 | + 'people_more_active' => _('More active people'), | ||
301 | + 'people_more_popular' => _('More popular people'), | ||
302 | + 'communities_more_recent' => _('More recent communities'), | ||
303 | + 'communities_more_active' => _('More active communities'), | ||
304 | + 'communities_more_popular' => _('More popular communities'), | ||
305 | + }[str] || str | ||
306 | + end | ||
307 | + | ||
308 | + def load_search_assets | ||
309 | + @search_in = where_to_search | ||
310 | + @searching = {} | ||
311 | + @search_in.each do |key, name| | ||
312 | + @searching[key] = (params[:asset].blank? && (params[:find_in].nil? || params[:find_in].empty? || params[:find_in].include?(key.to_s))) || (params[:asset] == key.to_s) | ||
313 | + end | ||
314 | + end | ||
315 | + | ||
316 | + def check_search_whole_site | ||
317 | + if params[:search_whole_site_yes] or params[:search_whole_site] == 'yes' | ||
318 | + redirect_to params.merge(:category_path => [], :search_whole_site => nil, :search_whole_site_yes => nil) | ||
319 | + end | ||
320 | + end | ||
321 | + | ||
322 | + FILTERS = %w( | ||
323 | + more_recent | ||
324 | + more_active | ||
325 | + more_popular | ||
326 | + ) | ||
327 | + | ||
328 | + def paginate_options(asset, limit, page) | ||
329 | + result = { :per_page => limit, :page => page } | ||
330 | + end | ||
331 | + | ||
332 | + def solr_options(asset, facet, solr_order) | ||
333 | + result = {} | ||
334 | + | ||
335 | + if asset_class(asset).methods.include?('facets') | ||
336 | + result.merge!(:facets => {:zeros => false, :sort => :count, :fields => asset_class(asset).facets.keys, | ||
337 | + :browse => facet ? facet.map{ |k,v| k.to_s+':"'+v.to_s+'"'} : ''}) | ||
338 | + end | ||
339 | + | ||
340 | + if solr_order | ||
341 | + result[:order_by] = solr_order | ||
342 | + end | ||
343 | + | ||
344 | + result | ||
345 | + end | ||
346 | + | ||
347 | + def limit | ||
348 | + searching = @searching.values.select{|v|v} | ||
349 | + if params[:display] == 'map' | ||
350 | + 2000 | ||
351 | + else | ||
352 | + (searching.size == 1) ? 20 : 6 | ||
353 | + end | ||
354 | + end | ||
355 | + | ||
356 | + def asset_class(asset) | ||
357 | + asset.to_s.singularize.camelize.constantize | ||
358 | + end | ||
359 | + | ||
360 | + def asset_table(asset) | ||
361 | + asset_class(asset).table_name | ||
362 | + end | ||
363 | + | ||
251 | end | 364 | end |
app/helpers/application_helper.rb
@@ -572,7 +572,7 @@ module ApplicationHelper | @@ -572,7 +572,7 @@ module ApplicationHelper | ||
572 | end | 572 | end |
573 | extra_info = extra_info.nil? ? '' : content_tag( 'span', extra_info, :class => 'extra_info' ) | 573 | extra_info = extra_info.nil? ? '' : content_tag( 'span', extra_info, :class => 'extra_info' ) |
574 | links = links_for_balloon(profile) | 574 | links = links_for_balloon(profile) |
575 | - content_tag tag, | 575 | + content_tag('div', content_tag(tag, |
576 | (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? link_to( content_tag( 'span', _('Profile links')), '#', :onclick => "toggleSubmenu(this, '#{profile.short_name}', #{links.to_json}); return false", :class => "menu-submenu-trigger #{trigger_class}", :url => url) : "") + | 576 | (environment.enabled?(:show_balloon_with_profile_links_when_clicked) ? link_to( content_tag( 'span', _('Profile links')), '#', :onclick => "toggleSubmenu(this, '#{profile.short_name}', #{links.to_json}); return false", :class => "menu-submenu-trigger #{trigger_class}", :url => url) : "") + |
577 | link_to( | 577 | link_to( |
578 | content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) + | 578 | content_tag( 'span', profile_image( profile, size ), :class => 'profile-image' ) + |
@@ -582,7 +582,7 @@ module ApplicationHelper | @@ -582,7 +582,7 @@ module ApplicationHelper | ||
582 | :class => 'profile_link url', | 582 | :class => 'profile_link url', |
583 | :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name, | 583 | :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name, |
584 | :title => profile.name ), | 584 | :title => profile.name ), |
585 | - :class => 'vcard' | 585 | + :class => 'vcard'), :class => 'common-profile-list-block') |
586 | end | 586 | end |
587 | 587 | ||
588 | def gravatar_url_for(email, options = {}) | 588 | def gravatar_url_for(email, options = {}) |
@@ -887,9 +887,6 @@ module ApplicationHelper | @@ -887,9 +887,6 @@ module ApplicationHelper | ||
887 | def search_page_title(title, options={}) | 887 | def search_page_title(title, options={}) |
888 | title = "<h1>" + title + "</h1>" | 888 | title = "<h1>" + title + "</h1>" |
889 | title += "<h2 class='query'>" + _("Searched for '%s'") % options[:query] + "</h2>" if !options[:query].blank? | 889 | title += "<h2 class='query'>" + _("Searched for '%s'") % options[:query] + "</h2>" if !options[:query].blank? |
890 | - title += "<h2 class='query'>" + _("In category %s") % options[:category] + "</h2>" if !options[:category].blank? | ||
891 | - title += "<h2 class='query'>" + _("within %d km from %s") % [options[:distance], options[:region]] + "</h2>" if !options[:distance].blank? && !options[:region].blank? | ||
892 | - title += "<h2 class='query'>" + _("%d results found") % options[:total_results] + "</h2>" if !options[:total_results].blank? | ||
893 | title | 890 | title |
894 | end | 891 | end |
895 | 892 | ||
@@ -1105,33 +1102,46 @@ module ApplicationHelper | @@ -1105,33 +1102,46 @@ module ApplicationHelper | ||
1105 | ") : '') | 1102 | ") : '') |
1106 | end | 1103 | end |
1107 | 1104 | ||
1108 | - def browse_people_menu | 1105 | + def search_contents_menu |
1106 | + links = [ | ||
1107 | + {s_('contents|More Recent') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_recent'})}}, | ||
1108 | + #{s_('contents|More Popular') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_popular'})}} | ||
1109 | + ] | ||
1110 | + if logged_in? | ||
1111 | + links.push(_('New Content') => lightbox_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})})) | ||
1112 | + end | ||
1113 | + | ||
1114 | + link_to(content_tag(:span, _('Contents'), :class => 'icon-menu-contents'), {:controller => "search", :action => 'contents'}, :id => 'submenu-contents') + | ||
1115 | + link_to(content_tag(:span, _('Contents Menu')), '#', :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-contents-trigger') | ||
1116 | + end | ||
1117 | + | ||
1118 | + def search_people_menu | ||
1109 | links = [ | 1119 | links = [ |
1110 | - {s_('people|More Recent') => {:href => url_for({:controller => 'browse', :action => 'people', :filter => 'more_recent'})}}, | ||
1111 | - {s_('people|More Active') => {:href => url_for({:controller => 'browse', :action => 'people', :filter => 'more_active'})}}, | ||
1112 | - {s_('people|More Popular') => {:href => url_for({:controller => 'browse', :action => 'people', :filter => 'more_popular'})}} | 1120 | + {s_('people|More Recent') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_recent'})}}, |
1121 | + {s_('people|More Active') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_active'})}}, | ||
1122 | + {s_('people|More Popular') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_popular'})}} | ||
1113 | ] | 1123 | ] |
1114 | if logged_in? | 1124 | if logged_in? |
1115 | links.push(_('My friends') => {:href => url_for({:profile => current_user.login, :controller => 'friends'})}) | 1125 | links.push(_('My friends') => {:href => url_for({:profile => current_user.login, :controller => 'friends'})}) |
1116 | links.push(_('Invite friends') => {:href => url_for({:profile => current_user.login, :controller => 'invite', :action => 'friends'})}) | 1126 | links.push(_('Invite friends') => {:href => url_for({:profile => current_user.login, :controller => 'invite', :action => 'friends'})}) |
1117 | end | 1127 | end |
1118 | 1128 | ||
1119 | - link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "browse", :action => 'people'}, :id => 'submenu-people') + | 1129 | + link_to(content_tag(:span, _('People'), :class => 'icon-menu-people'), {:controller => "search", :action => 'people'}, :id => 'submenu-people') + |
1120 | link_to(content_tag(:span, _('People Menu')), '#', :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-people-trigger') | 1130 | link_to(content_tag(:span, _('People Menu')), '#', :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-people-trigger') |
1121 | end | 1131 | end |
1122 | 1132 | ||
1123 | - def browse_communities_menu | 1133 | + def search_communities_menu |
1124 | links = [ | 1134 | links = [ |
1125 | - {s_('communities|More Recent') => {:href => url_for({:controller => 'browse', :action => 'communities', :filter => 'more_recent'})}}, | ||
1126 | - {s_('communities|More Active') => {:href => url_for({:controller => 'browse', :action => 'communities', :filter => 'more_active'})}}, | ||
1127 | - {s_('communities|More Popular') => {:href => url_for({:controller => 'browse', :action => 'communities', :filter => 'more_popular'})}} | 1135 | + {s_('communities|More Recent') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_recent'})}}, |
1136 | + {s_('communities|More Active') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_active'})}}, | ||
1137 | + {s_('communities|More Popular') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_popular'})}} | ||
1128 | ] | 1138 | ] |
1129 | if logged_in? | 1139 | if logged_in? |
1130 | links.push(_('My communities') => {:href => url_for({:profile => current_user.login, :controller => 'memberships'})}) | 1140 | links.push(_('My communities') => {:href => url_for({:profile => current_user.login, :controller => 'memberships'})}) |
1131 | links.push(_('New community') => {:href => url_for({:profile => current_user.login, :controller => 'memberships', :action => 'new_community'})}) | 1141 | links.push(_('New community') => {:href => url_for({:profile => current_user.login, :controller => 'memberships', :action => 'new_community'})}) |
1132 | end | 1142 | end |
1133 | 1143 | ||
1134 | - link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "browse", :action => 'communities'}, :id => 'submenu-communities') + | 1144 | + link_to(content_tag(:span, _('Communities'), :class => 'icon-menu-community'), {:controller => "search", :action => 'communities'}, :id => 'submenu-communities') + |
1135 | link_to(content_tag(:span, _('Communities Menu')), '#', :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-communities-trigger') | 1145 | link_to(content_tag(:span, _('Communities Menu')), '#', :onclick => "toggleSubmenu(this,'',#{links.to_json}); return false", :class => 'menu-submenu-trigger up', :id => 'submenu-communities-trigger') |
1136 | end | 1146 | end |
1137 | 1147 |
app/views/browse/_article.rhtml
@@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
1 | -<li class="<%= 'browse-results-type-content ' + icon_for_article(result) %>"> | ||
2 | - <strong><%= link_to(result.title, result.view_url) %></strong> | ||
3 | - <div class="item_meta"> | ||
4 | - <span class="item_by"> | ||
5 | - <%= _('by %s') % link_to(result.author.name, result.author.url) %> | ||
6 | - </span> | ||
7 | - <span class="extra-info"> | ||
8 | - <%= (@filter == 'more_recent' ? result.send(@filter + '_label') + show_date(result.created_at) : result.send(@filter + '_label')) %> | ||
9 | - </span> | ||
10 | - </div> | ||
11 | -</li> |
app/views/browse/_display_results.rhtml
@@ -1,19 +0,0 @@ | @@ -1,19 +0,0 @@ | ||
1 | -<div id="browse-results"> | ||
2 | - | ||
3 | - <div class='browse-results-innerbox'> | ||
4 | - <% if @results.empty? %> | ||
5 | - <div class="browse-results-type-empty"> | ||
6 | - <div> <%= _('None') %> </div> | ||
7 | - </div><!-- end class="browse-results-innerbox" --> | ||
8 | - <% end %> | ||
9 | - <ul class='common-profile-list-block'> | ||
10 | - <% @results.each do |result| %> | ||
11 | - <%= render :partial => partial_for_class(result.class), :locals => {:result => result} %> | ||
12 | - <% end %> | ||
13 | - </ul> | ||
14 | - <br style='clear: both;'> | ||
15 | - </div> | ||
16 | - | ||
17 | - <br style="clear:both" /> | ||
18 | -</div><!-- end id="browse-results" --> | ||
19 | - |
app/views/browse/_person.rhtml
app/views/browse/_profile.rhtml
@@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
1 | -<%= profile_image_link result, :portrait, 'li', @filter == 'more_recent' ? result.send(@filter + '_label') + show_date(result.created_at) : result.send(@filter + '_label') %> |
app/views/browse/_search_form.rhtml
@@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
1 | -<% form_tag( { :controller => 'browse', :action => action}, :method => 'get', :class => 'search_form' ) do %> | ||
2 | - | ||
3 | - <div class="search-field"> | ||
4 | - <span class="formfield"> | ||
5 | - <%= text_field_tag 'query', @query, :size => 50 %> | ||
6 | - </span> | ||
7 | - <%= submit_button(:search, _('Search')) %> | ||
8 | - </div> | ||
9 | - | ||
10 | -<% end %> |
app/views/browse/communities.rhtml
@@ -1,9 +0,0 @@ | @@ -1,9 +0,0 @@ | ||
1 | -<%= search_page_title( @title, { :query => @query} ) %> | ||
2 | - | ||
3 | -<%= render :partial => 'search_form', :locals => {:action => 'communities'} %> | ||
4 | - | ||
5 | -<%= render :partial => 'display_results' %> | ||
6 | - | ||
7 | -<%= pagination_links @results %> | ||
8 | - | ||
9 | -<br style="clear:both" /> |
app/views/browse/contents.rhtml
app/views/browse/people.rhtml
app/views/search/_enterprise.rhtml
@@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
1 | -<% if params[:query].blank? %> | ||
2 | - <%= profile_image_link enterprise, :portrait %> | ||
3 | -<% else %> | ||
4 | - <div class="enterprise-result"> | ||
5 | - <%= profile_image_link enterprise, :portrait %> | ||
6 | - <span><%= enterprise.name %></span> | ||
7 | - <span><%= _("Region: ") + enterprise.region.name if enterprise.region %></span> | ||
8 | - <span><%= enterprise.description %></span> | ||
9 | - | ||
10 | - <div class="enterprise-categorization"> | ||
11 | - <% enterprise.top_level_categorization.each do |parent, children| %> | ||
12 | - <span class="enterprise-categorization-parent"><%= parent.name + ':' %></span> | ||
13 | - <span class="enterprise-categorization-children"><%= children.collect(&:name).join(', ') %></span> | ||
14 | - <% end %> | ||
15 | - </div> | ||
16 | - </div> | ||
17 | -<% end %> |
app/views/search/_profile.rhtml
1 | -<%= profile_image_link profile, :portrait %> | 1 | +<% if @query.blank? || !profile.enterprise? %> |
2 | + <%= profile_image_link profile, :portrait %> | ||
3 | +<% else %> | ||
4 | + <div class="enterprise-result"> | ||
5 | + <%= profile_image_link profile, :portrait %> | ||
6 | + <span><%= profile.name %></span> | ||
7 | + <span><%= _("Region: ") + profile.region.name if profile.region %></span><br /> | ||
8 | + <% if !profile.description.blank? %> | ||
9 | + <span><%= profile.description %></span><br /> | ||
10 | + <% end %> | ||
11 | + | ||
12 | + <div class="enterprise-categorization"> | ||
13 | + <% profile.top_level_categorization.each do |parent, children| %> | ||
14 | + <span class="enterprise-categorization-parent"><%= parent.name + ':' %></span> | ||
15 | + <span class="enterprise-categorization-children"><%= children.collect(&:name).join(', ') %></span> | ||
16 | + <br /> | ||
17 | + <% end %> | ||
18 | + </div> | ||
19 | + </div> | ||
20 | +<% end %> |
app/views/search/_search_form.rhtml
1 | <div class='search-form'> | 1 | <div class='search-form'> |
2 | <% simple_search = false unless defined? simple_search %> | 2 | <% simple_search = false unless defined? simple_search %> |
3 | 3 | ||
4 | -<% form_tag( { :controller => 'search', :action => 'index', :asset => nil, :category_path => ( @category ? @category.explode_path : [] ) }, | 4 | +<% form_tag( { :controller => 'search', :action => @asset ? @asset : 'index', :asset => nil, :category_path => ( @category ? @category.explode_path : [] ) }, |
5 | :method => 'get', :class => 'search_form' ) do %> | 5 | :method => 'get', :class => 'search_form' ) do %> |
6 | <%= '<h3>%s</h3>' % form_title if defined? form_title %> | 6 | <%= '<h3>%s</h3>' % form_title if defined? form_title %> |
7 | 7 | ||
@@ -20,41 +20,6 @@ | @@ -20,41 +20,6 @@ | ||
20 | <% end %> | 20 | <% end %> |
21 | </div> | 21 | </div> |
22 | 22 | ||
23 | - <div id='advanced-search-options' style="display: <%= simple_search ? 'none' : 'block' %>"> | ||
24 | - <div class="search-options search-within"> | ||
25 | - <h4><%= _('Search within:') %></h4> | ||
26 | - <br style='clear:left'/> | ||
27 | - <div> | ||
28 | - <span class="formfield"> | ||
29 | - <%= select_city %> | ||
30 | - </span> | ||
31 | - <span class="formfield"> | ||
32 | - <%= labelled_select(_('Distance:'), 'radius', :first, :last, nil, [15, 30, 50, 100, 150, 200, 300, 400, 500, 1000].map{|n|[n, n.to_s + 'km']}) %> | ||
33 | - </span> | ||
34 | - </div> | ||
35 | - </div><!-- fim class="search-options" --> | ||
36 | - | ||
37 | - <div class="search-options search-for"> | ||
38 | - <h4><%= _('Search for:') %></h4> | ||
39 | - <ul> | ||
40 | - <% @search_in.map { |t,n| [t,getterm(n)] } . | ||
41 | - sort_by(&:last).each do |thing, name| %> | ||
42 | - <li> | ||
43 | - <%= labelled_check_box name, 'find_in[]', thing.to_s, @searching[thing.to_sym] %> | ||
44 | - </li> | ||
45 | - <% end %> | ||
46 | - </ul> | ||
47 | - <br style="clear:both" /> | ||
48 | - </div><!-- fim class="search-options" --> | ||
49 | - </div><!-- end id="advanced-search-options" --> | ||
50 | - | ||
51 | - <% if simple_search %> | ||
52 | - <%= link_to_function(_('More options'), nil, :id => 'advanced_search_link') do |page| | ||
53 | - page['advanced_search_link'].hide | ||
54 | - page['advanced-search-options'].toggle | ||
55 | - end %> | ||
56 | - <% end %> | ||
57 | - | ||
58 | <% if lightbox?; button_bar do %> | 23 | <% if lightbox?; button_bar do %> |
59 | <%= lightbox_close_button _('Close') %> | 24 | <%= lightbox_close_button _('Close') %> |
60 | <% end; end %> | 25 | <% end; end %> |
app/views/search/articles.rhtml
1 | <%= search_page_title( _('Articles'), { :query => @query, | 1 | <%= search_page_title( _('Articles'), { :query => @query, |
2 | - :category => @category ? @category.name : nil, | ||
3 | - :total_results => @total_results, | ||
4 | - :region => @region ? @region.name : nil, | ||
5 | - :distance => @radius } ) %> | 2 | + :total_results => @total_results } ) %> |
6 | 3 | ||
7 | <%= search_page_link_to_all( { :asset => params[:asset], | 4 | <%= search_page_link_to_all( { :asset => params[:asset], |
8 | :category => @category }) %> | 5 | :category => @category }) %> |
@@ -10,7 +7,7 @@ | @@ -10,7 +7,7 @@ | ||
10 | <%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %> | 7 | <%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %> |
11 | 8 | ||
12 | <% if !@query.blank? %> | 9 | <% if !@query.blank? %> |
13 | - <%= facets_menu(:articles, @facets[:articles]) %> | 10 | + <%= facets_menu(:articles, @facets) %> |
14 | <% end %> | 11 | <% end %> |
15 | 12 | ||
16 | <%= render :partial => 'results_header', :locals => { :asset => :articles, :results => @results[:articles] } %> | 13 | <%= render :partial => 'results_header', :locals => { :asset => :articles, :results => @results[:articles] } %> |
app/views/search/cities.rhtml
app/views/search/communities.rhtml
1 | <%= search_page_title( __('Communities'), { :query => @query, | 1 | <%= search_page_title( __('Communities'), { :query => @query, |
2 | - :category => @category ? @category.name : nil, | ||
3 | - :total_results => @total_results, | ||
4 | - :region => @region ? @region.name : nil, | ||
5 | - :distance => @radius } ) %> | 2 | + :total_results => @total_results } ) %> |
6 | 3 | ||
7 | <%= search_page_link_to_all( { :asset => params[:asset], | 4 | <%= search_page_link_to_all( { :asset => params[:asset], |
8 | :category => @category }) %> | 5 | :category => @category }) %> |
@@ -16,7 +13,7 @@ | @@ -16,7 +13,7 @@ | ||
16 | <% end %> | 13 | <% end %> |
17 | 14 | ||
18 | <% if !@query.blank? %> | 15 | <% if !@query.blank? %> |
19 | - <%= facets_menu(:communities, @facets[:communities]) %> | 16 | + <%= facets_menu(:communities, @facets) %> |
20 | <% end %> | 17 | <% end %> |
21 | <%= render :partial => 'results_header', :locals => { :asset => :communities, :results => @results[:communities] } %> | 18 | <%= render :partial => 'results_header', :locals => { :asset => :communities, :results => @results[:communities] } %> |
22 | 19 |
app/views/search/complete_region.rhtml
app/views/search/enterprises.rhtml
@@ -6,12 +6,7 @@ | @@ -6,12 +6,7 @@ | ||
6 | <% end %> | 6 | <% end %> |
7 | </h1> | 7 | </h1> |
8 | 8 | ||
9 | -<% if @radius && @region %> | ||
10 | - <h2><%=h (_('Within %s km from %s') % [@radius, @region.name]) %><h2> | ||
11 | -<% end %> | ||
12 | - | ||
13 | -<%= search_page_link_to_all( { :asset => params[:asset], | ||
14 | - :category => @category }) %> | 9 | +<%= search_page_link_to_all( { :asset => params[:asset] }) %> |
15 | 10 | ||
16 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> | 11 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> |
17 | 12 | ||
@@ -25,11 +20,9 @@ | @@ -25,11 +20,9 @@ | ||
25 | <div class="has_cat_list"> | 20 | <div class="has_cat_list"> |
26 | <% end %> | 21 | <% end %> |
27 | 22 | ||
28 | -<% cache(:action => 'assets', :asset => 'enterprises', :category_path => params[:category_path], :query => @query, :product_category => @product_category, :region => @region, :radius => params[:radius]) do %> | ||
29 | - <% if @query.blank? %> | ||
30 | - <%= product_categories_menu(:enterprises, @product_category, @result_ids) %> | ||
31 | - <% else %> | ||
32 | - <%= facets_menu(:enterprises, @facets[:enterprises]) %> | 23 | +<% cache(:action => 'assets', :asset => 'enterprises', :query => @query) do %> |
24 | + <% if !@query.blank? %> | ||
25 | + <%= facets_menu(:enterprises, @facets) %> | ||
33 | <% end %> | 26 | <% end %> |
34 | <% end %> | 27 | <% end %> |
35 | 28 |
app/views/search/index.rhtml
1 | <div id="search-page"> | 1 | <div id="search-page"> |
2 | 2 | ||
3 | -<%= search_page_title(_('Search Results'), :query => CGI.escapeHTML(@query), :category => @category ? @category.name : nil, :total_results => @total_results) %> | 3 | +<%= search_page_title(_('Search Results'), :query => CGI.escapeHTML(@query), |
4 | + :total_results => @total_results) %> | ||
4 | 5 | ||
5 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> | 6 | <%= render :partial => 'search_form', :locals => { :form_title => _("Refine your search"), :simple_search => true } %> |
6 | 7 |
app/views/search/people.rhtml
1 | <%= search_page_title( _('People'), { :query => @query, | 1 | <%= search_page_title( _('People'), { :query => @query, |
2 | - :category => @category ? @category.name : nil, | ||
3 | - :total_results => @total_results, | ||
4 | - :region => @region ? @region.name : nil, | ||
5 | - :distance => @radius } ) %> | 2 | + :total_results => @total_results } ) %> |
6 | 3 | ||
7 | <%= search_page_link_to_all( { :asset => params[:asset], | 4 | <%= search_page_link_to_all( { :asset => params[:asset], |
8 | :category => @category }) %> | 5 | :category => @category }) %> |
@@ -10,7 +7,7 @@ | @@ -10,7 +7,7 @@ | ||
10 | <%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %> | 7 | <%= render :partial => 'search_form', :locals => { :form_title => @query.blank? ? _('Search') : _("Refine your search"), :simple_search => true } %> |
11 | 8 | ||
12 | <% if !@query.blank? %> | 9 | <% if !@query.blank? %> |
13 | - <%= facets_menu(:people, @facets[:people]) %> | 10 | + <%= facets_menu(:people, @facets) %> |
14 | <% end %> | 11 | <% end %> |
15 | 12 | ||
16 | <%= render :partial => 'results_header', :locals => { :asset => :people, :results => @results[:people] } %> | 13 | <%= render :partial => 'results_header', :locals => { :asset => :people, :results => @results[:people] } %> |
app/views/search/products.rhtml
1 | <%= search_page_title( _('Products and Services'), { :query => @query, | 1 | <%= search_page_title( _('Products and Services'), { :query => @query, |
2 | - :category => @category ? @category.name : nil, | ||
3 | - :total_results => @total_results, | ||
4 | - :region => @region ? @region.name : nil, | ||
5 | - :distance => @radius } ) %> | 2 | + :total_results => @total_results } ) %> |
6 | 3 | ||
7 | <%= search_page_link_to_all( { :asset => params[:asset], | 4 | <%= search_page_link_to_all( { :asset => params[:asset], |
8 | :category => @category }) %> | 5 | :category => @category }) %> |
@@ -13,11 +10,9 @@ | @@ -13,11 +10,9 @@ | ||
13 | <div class="has_cat_list"> | 10 | <div class="has_cat_list"> |
14 | <% end %> | 11 | <% end %> |
15 | 12 | ||
16 | -<% cache(:action => 'assets', :asset => 'products', :category_path => params[:category_path], :query => @query, :product_category => @product_category, :region => @region, :radius => params[:radius]) do %> | ||
17 | - <% if @query.empty? %> | ||
18 | - <%= product_categories_menu(:products, @product_category, @result_ids) %> | ||
19 | - <% else %> | ||
20 | - <%= facets_menu(:products, @facets[:products]) %> | 13 | +<% cache(:action => 'assets', :asset => 'products', :query => @query) do %> |
14 | + <% if !@query.blank? %> | ||
15 | + <%= facets_menu(:products, @facets) %> | ||
21 | <% end %> | 16 | <% end %> |
22 | <% end %> | 17 | <% end %> |
23 | 18 |