Add params filtering in Management::EventsController#index
This commit is contained in:
parent
48c979549f
commit
b774cb9b11
|
@ -2,7 +2,7 @@ module Management
|
|||
class EventsController < ManagementController
|
||||
def index
|
||||
@conference = find_conference
|
||||
@filters = params[:filters] || {}
|
||||
@filters = filter_params || {}
|
||||
@events = EventSearch.new(scope: Event.where(conference: @conference).eager_load(:participants_with_personal_profiles, :proposition, :proposer, :track, :event_type).preload(:conference), filters: params[:filters]).results
|
||||
# @events = @conference.events.order(:title).includes(:proposition, :proposer, :track, :event_type)
|
||||
end
|
||||
|
@ -49,6 +49,17 @@ module Management
|
|||
Conference.find(params[:conference_id])
|
||||
end
|
||||
|
||||
def filter_params
|
||||
params.fetch(:filters, {}).permit(
|
||||
:event_type_id,
|
||||
:track_id,
|
||||
:language,
|
||||
:status,
|
||||
:confirmed,
|
||||
:not_confirmed,
|
||||
)
|
||||
end
|
||||
|
||||
def event_params
|
||||
params.require(:event).permit(
|
||||
:title,
|
||||
|
|
Loading…
Reference in New Issue