2016-10-08 19:29:08 +03:00
|
|
|
class EventSearch
|
2016-10-08 21:19:58 +03:00
|
|
|
include SearchObject.module(:sorting)
|
2016-10-08 19:29:08 +03:00
|
|
|
|
|
|
|
option(:title) { |scope, value| scope.where title: value }
|
|
|
|
option(:language) { |scope, value| scope.where language: value }
|
|
|
|
option(:track_id) { |scope, value| scope.where track_id: value }
|
|
|
|
option(:event_type_id) { |scope, value| scope.where event_type_id: value }
|
|
|
|
option(:status) { |scope, value| scope.joins(:proposition).where(propositions: {status: value}) }
|
2016-10-08 21:19:58 +03:00
|
|
|
|
2016-10-08 21:40:55 +03:00
|
|
|
sort_by 'title'
|
|
|
|
config[:defaults]['sort'] = "#{config[:sort_attributes].first} asc"
|
2016-10-08 19:29:08 +03:00
|
|
|
end
|