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 | class MapBalloonController < PublicController | 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 | def product | 7 | def product |
6 | @product = Product.find(params[:id]) | 8 | @product = Product.find(params[:id]) |
@@ -21,7 +23,7 @@ class MapBalloonController < PublicController | @@ -21,7 +23,7 @@ class MapBalloonController < PublicController | ||
21 | 23 | ||
22 | protected | 24 | protected |
23 | 25 | ||
24 | - def profile | 26 | + def load_profile |
25 | @profile = Profile.find(params[:id]) | 27 | @profile = Profile.find(params[:id]) |
26 | end | 28 | end |
27 | 29 |
app/helpers/search_helper.rb
@@ -131,7 +131,7 @@ module SearchHelper | @@ -131,7 +131,7 @@ module SearchHelper | ||
131 | 131 | ||
132 | def order_by(asset) | 132 | def order_by(asset) |
133 | options = { | 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 | :events => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], | 135 | :events => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], |
136 | :articles => [[_('Relevance'), ''], [_('Name'), 'name_sort asc'], [_('Most recent'), 'updated_at desc']], | 136 | :articles => [[_('Relevance'), ''], [_('Name'), 'name_sort asc'], [_('Most recent'), 'updated_at desc']], |
137 | :enterprises => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], | 137 | :enterprises => [[_('Relevance'), ''], [_('Name'), 'name_sort asc']], |
lib/acts_as_faceted.rb
@@ -134,13 +134,9 @@ module ActsAsFaceted | @@ -134,13 +134,9 @@ module ActsAsFaceted | ||
134 | if facet[:queries_order] | 134 | if facet[:queries_order] |
135 | facets_data | 135 | facets_data |
136 | elsif sort_by == :alphabetically | 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 | elsif sort_by == :count | 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 | else | 140 | else |
145 | facets_data | 141 | facets_data |
146 | end | 142 | end |
lib/set_profile_region_from_city_state.rb
@@ -28,6 +28,8 @@ module SetProfileRegionFromCityState | @@ -28,6 +28,8 @@ module SetProfileRegionFromCityState | ||
28 | if s | 28 | if s |
29 | c = City.find_by_contents(self.city, {}, :filter_queries => ["parent_id:#{s.id}"])[:results].first | 29 | c = City.find_by_contents(self.city, {}, :filter_queries => ["parent_id:#{s.id}"])[:results].first |
30 | self.region = c | 30 | self.region = c |
31 | + else | ||
32 | + self.region = nil | ||
31 | end | 33 | end |
32 | end | 34 | end |
33 | end | 35 | end |