diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index adf1bde7a..939b4d967 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -182,6 +182,17 @@ def toggle_attendance end end + def destroy + @event = Event.find(params[:id]) + if @event.destroy + flash[:notice] = 'Event successfully deleted.' + redirect_to admin_conference_program_events_path(@conference.short_title) + else + flash[:alert] = 'Event could not be deleted.' + redirect_to admin_conference_program_event_path(@conference.short_title, @event) + end + end + private def event_params diff --git a/app/views/admin/events/_proposal.html.haml b/app/views/admin/events/_proposal.html.haml index ae50c63d2..0fc5aa459 100644 --- a/app/views/admin/events/_proposal.html.haml +++ b/app/views/admin/events/_proposal.html.haml @@ -11,6 +11,8 @@ = link_to 'Preview', conference_program_proposal_path(@conference.short_title, @event.id), class: 'btn btn-mini btn-primary' = link_to 'Registrations', registrations_admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-success' = link_to 'Edit', edit_admin_conference_program_event_path(@conference.short_title, @event), class: 'btn btn-mini btn-primary' + = link_to 'Delete', admin_conference_program_event_path(@conference.short_title, @event), method: :delete, data: { confirm: 'Are you sure you want to delete this event?' }, class: 'btn btn-mini btn-danger' + .row .col-md-12