Commit 20f951d7d01c0f9b9d843d0b9f1187c658398896
1 parent
a4fbd0ea
Exists in
master
and in
22 other branches
Bugfix map ballon and facet sorting
Showing
4 changed files
with
9 additions
and
9 deletions
Show diff stats
app/controllers/public/map_balloon_controller.rb
1 | 1 | class MapBalloonController < PublicController |
2 | 2 | |
3 | - before_filter :profile, :only => [:person, :enterprise, :community] | |
3 | + helper SearchHelper | |
4 | + | |
5 | + before_filter :load_profile, :only => [:person, :enterprise, :community] | |
4 | 6 | |
5 | 7 | def product |
6 | 8 | @product = Product.find(params[:id]) |
... | ... | @@ -21,7 +23,7 @@ class MapBalloonController < PublicController |
21 | 23 | |
22 | 24 | protected |
23 | 25 | |
24 | - def profile | |
26 | + def load_profile | |
25 | 27 | @profile = Profile.find(params[:id]) |
26 | 28 | end |
27 | 29 | ... | ... |
app/helpers/search_helper.rb
... | ... | @@ -131,7 +131,7 @@ module SearchHelper |
131 | 131 | |
132 | 132 | def order_by(asset) |
133 | 133 | options = { |
134 | - :products => [[_('Relevance'), ''], [_('More Recent'), 'updated_at desc'], [_('Name'), 'name_or_category_sort asc'], [_('Lower price'), 'price_sort asc'], [_('Higher price'), 'price_sort desc']], | |
134 | + :products => [[_('Relevance'), ''], [_('More Recent'), 'updated_at desc'], [_('Name'), 'name_or_category_sort asc']], | |
135 | 135 | :events => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], |
136 | 136 | :articles => [[_('Relevance'), ''], [_('Name'), 'name_sort asc'], [_('Most recent'), 'updated_at desc']], |
137 | 137 | :enterprises => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], | ... | ... |
lib/acts_as_faceted.rb
... | ... | @@ -134,13 +134,9 @@ module ActsAsFaceted |
134 | 134 | if facet[:queries_order] |
135 | 135 | facets_data |
136 | 136 | elsif sort_by == :alphabetically |
137 | - facets_data.sort do |a,b| | |
138 | - a = a[1].is_a?(String) ? a[1] : a.first | |
139 | - b = b[1].is_a?(String) ? b[1] : b.first | |
140 | - a <=> b | |
141 | - end | |
137 | + facets_data.sort{ |a,b| Array(a[1])[0] <=> Array(b[1])[0] } | |
142 | 138 | elsif sort_by == :count |
143 | - facets_data.sort{ |a,b| -1*(a[2] <=> b[2]) } | |
139 | + facets_data.sort{ |a,b| -1*(a[2] <=> b[2]) } | |
144 | 140 | else |
145 | 141 | facets_data |
146 | 142 | end | ... | ... |
lib/set_profile_region_from_city_state.rb