diff --git a/app/assets/javascripts/answerbox/destroy.coffee b/app/assets/javascripts/answerbox/destroy.coffee index 4e161823..111d3743 100644 --- a/app/assets/javascripts/answerbox/destroy.coffee +++ b/app/assets/javascripts/answerbox/destroy.coffee @@ -1,4 +1,5 @@ -$(document).on "click", "button[name=ab-destroy]", -> +$(document).on "click", "a[data-action=ab-destroy]", (ev) -> + ev.preventDefault() if confirm 'Are you sure?' btn = $(this) btn.button "loading" diff --git a/app/views/shared/_answerbox_buttons.html.haml b/app/views/shared/_answerbox_buttons.html.haml index 38c7a0ee..11add7d0 100644 --- a/app/views/shared/_answerbox_buttons.html.haml +++ b/app/views/shared/_answerbox_buttons.html.haml @@ -23,7 +23,7 @@ %ul.dropdown-menu.dropdown-menu-right{role: :menu} - if privileged? a.user %li.text-danger - %a{href: '#', name: 'ab-destroy', data: { a_id: a.id }} + %a{href: '#', data: { a_id: a.id, action: 'ab-destroy' }} %i.fa.fa-trash-o Delete %li