2014-09-30 13:34:09 +03:00
|
|
|
module Management
|
|
|
|
class EventsController < ManagementController
|
2015-07-14 21:00:02 +03:00
|
|
|
before_action :require_current_conference
|
|
|
|
|
2014-09-30 13:34:09 +03:00
|
|
|
def index
|
2015-07-14 21:00:02 +03:00
|
|
|
# TODO (2015-07-14) Scoped by conference? Why no conference_id
|
|
|
|
@events = Event.all
|
2014-10-10 20:25:41 +03:00
|
|
|
end
|
|
|
|
|
2014-09-30 13:34:09 +03:00
|
|
|
def show
|
2015-07-14 21:00:02 +03:00
|
|
|
@event = Event.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
@event = Event.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
@event = Event.find(params[:id])
|
|
|
|
|
|
|
|
if @event.update_attributes(event_params)
|
|
|
|
flash[:notice] = 'Event was successfully updated.'
|
|
|
|
redirect_to [:management, @event]
|
|
|
|
else
|
|
|
|
render action: 'edit'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@event = Event.find(params[:id])
|
|
|
|
@event.destroy
|
|
|
|
|
|
|
|
redirect_to action: :index
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def event_params
|
|
|
|
params.require(:event).permit(
|
|
|
|
:title,
|
|
|
|
:subtitle,
|
|
|
|
:length,
|
|
|
|
:language,
|
|
|
|
:abstract,
|
|
|
|
:description,
|
|
|
|
:notes
|
|
|
|
)
|
2014-09-30 13:34:09 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|