diff --git a/app/javascript/controllers/rating_controller.js b/app/javascript/controllers/rating_controller.js index cd9dd0a85..410d3b68f 100644 --- a/app/javascript/controllers/rating_controller.js +++ b/app/javascript/controllers/rating_controller.js @@ -5,12 +5,16 @@ export default class extends Controller { connect() { this.showRating() - this.boundHandleChange = this.handleChange.bind(this) - this.formTarget.addEventListener('change', this.boundHandleChange) + if (this.hasFormTarget) { + this.boundHandleChange = this.handleChange.bind(this) + this.formTarget.addEventListener('change', this.boundHandleChange) + } } disconnect() { - this.formTarget.removeEventListener('change', this.boundHandleChange) + if (this.hasFormTarget && this.boundHandleChange) { + this.formTarget.removeEventListener('change', this.boundHandleChange) + } } handleChange(event) { diff --git a/app/views/proposals/show.html.haml b/app/views/proposals/show.html.haml index 0c27f9b2d..c03e1575e 100644 --- a/app/views/proposals/show.html.haml +++ b/app/views/proposals/show.html.haml @@ -26,7 +26,7 @@ - if proposal.speaker_can_withdraw?(current_user) = proposal.withdraw_button - if proposal.speaker_can_delete?(current_user) - = link_to event_proposal_path, data: {turbo: true, turbo_method: :delete, turbo_confirm: 'This will delete your talk. Are you sure you want to do this? It can not be undone.'}, class: 'btn btn-warning', id: 'delete' do + = link_to event_proposal_path(event, uuid: proposal), data: {turbo: true, turbo_method: :delete, turbo_confirm: 'This will delete your talk. Are you sure you want to do this? It can not be undone.'}, class: 'btn btn-warning', id: 'delete' do %span.bi.bi-exclamation-circle Delete Proposal