From 260d5cddd781e0641a90acd42f080e01ab171b78 Mon Sep 17 00:00:00 2001 From: nilsding Date: Sat, 27 Dec 2014 14:59:48 +0100 Subject: [PATCH] updated delete button --- app/assets/javascripts/answerbox/destroy.coffee | 3 ++- app/views/shared/_answerbox_buttons.html.haml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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