From 62ff980dc4a70983bfd59f97d933e2d68f8b5e36 Mon Sep 17 00:00:00 2001 From: Warren Huang Date: Sun, 21 Apr 2024 13:32:05 -0700 Subject: [PATCH 1/4] delete event enable --- app/controllers/admin/events_controller.rb | 14 ++++++++++++++ app/views/admin/events/_proposal.html.haml | 2 ++ 2 files changed, 16 insertions(+) diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index adf1bde7a..9d401e6fa 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 @@ -224,5 +235,8 @@ def load_events_with_data votes: [:user] ) end + end + + end 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 From 8aab77e1bc7744db7644846b6d5539640d37ceee Mon Sep 17 00:00:00 2001 From: Warren Huang Date: Sun, 28 Apr 2024 16:48:24 -0700 Subject: [PATCH 2/4] rubocop styling fix --- app/controllers/admin/events_controller.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/controllers/admin/events_controller.rb b/app/controllers/admin/events_controller.rb index 9d401e6fa..939b4d967 100644 --- a/app/controllers/admin/events_controller.rb +++ b/app/controllers/admin/events_controller.rb @@ -235,8 +235,5 @@ def load_events_with_data votes: [:user] ) end - end - - end From cab52b96819e829eaf6e91867e8956aa61b0b713 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 31 Jul 2024 18:01:14 -0700 Subject: [PATCH 3/4] Fix duplicate column in schema.rb Result of a bad merge(?) --- db/schema.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index b61c47ad5..ced24c2bb 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -548,7 +548,6 @@ t.float "amount_paid", default: 0.0 t.integer "amount_paid_cents", default: 0 t.string "currency" - t.integer "amount_paid_cents", default: 0 end create_table "ticket_scannings", force: :cascade do |t| From df73c3097f20242bcdba52f958073d73ed9e0aeb Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Wed, 31 Jul 2024 19:07:40 -0700 Subject: [PATCH 4/4] delete ticket currency migration this doesn't need to be here/doesn't belong in this PR --- ...7212948_set_currency_for_null_ticket_purchase_currency.rb | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 db/migrate/20240417212948_set_currency_for_null_ticket_purchase_currency.rb diff --git a/db/migrate/20240417212948_set_currency_for_null_ticket_purchase_currency.rb b/db/migrate/20240417212948_set_currency_for_null_ticket_purchase_currency.rb deleted file mode 100644 index 759aa644c..000000000 --- a/db/migrate/20240417212948_set_currency_for_null_ticket_purchase_currency.rb +++ /dev/null @@ -1,5 +0,0 @@ -class SetCurrencyForNullTicketPurchaseCurrency < ActiveRecord::Migration[7.0] - def up - TicketPurchase.where(currency: nil).update_all(currency: 'USD') - end -end