Skip to content

Commit

Permalink
Merge pull request #377 from cs169/187460419_Support_delete_event
Browse files Browse the repository at this point in the history
187460419 support delete event
  • Loading branch information
cycomachead authored Aug 1, 2024
2 parents 39fff29 + 4822214 commit 75fd0cb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/controllers/admin/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/events/_proposal.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 75fd0cb

Please sign in to comment.