diff --git a/app/assets/javascripts/answerbox/comment/destroy.coffee b/app/assets/javascripts/answerbox/comment/destroy.coffee index 02cdbea8..36505fa8 100644 --- a/app/assets/javascripts/answerbox/comment/destroy.coffee +++ b/app/assets/javascripts/answerbox/comment/destroy.coffee @@ -1,5 +1,7 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) -> ev.preventDefault() + btn = $(this) + cid = btn[0].dataset.cId swal title: "Really delete?" text: "You will not be able to recover this comment." @@ -7,10 +9,8 @@ $(document).on "click", "a[data-action=ab-comment-destroy]", (ev) -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Delete" - closeOnConfirm: false + closeOnConfirm: true , -> - btn = $(this) - cid = btn[0].dataset.cId $.ajax url: '/ajax/destroy_comment' type: 'POST' diff --git a/app/assets/javascripts/answerbox/comment/report.coffee b/app/assets/javascripts/answerbox/comment/report.coffee index 6aa245d4..559552fa 100644 --- a/app/assets/javascripts/answerbox/comment/report.coffee +++ b/app/assets/javascripts/answerbox/comment/report.coffee @@ -1,5 +1,7 @@ $(document).on "click", "a[data-action=ab-comment-report]", (ev) -> ev.preventDefault() + btn = $(this) + cid = btn[0].dataset.cId swal title: "Really report?" text: "A moderator will review this comment and decide what happens." @@ -7,10 +9,8 @@ $(document).on "click", "a[data-action=ab-comment-report]", (ev) -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Report" - closeOnConfirm: false + closeOnConfirm: true , -> - btn = $(this) - cid = btn[0].dataset.cId $.ajax url: '/ajax/report' type: 'POST' diff --git a/app/assets/javascripts/answerbox/destroy.coffee b/app/assets/javascripts/answerbox/destroy.coffee index ac3ad680..2a343bb6 100644 --- a/app/assets/javascripts/answerbox/destroy.coffee +++ b/app/assets/javascripts/answerbox/destroy.coffee @@ -1,5 +1,7 @@ $(document).on "click", "a[data-action=ab-destroy]", (ev) -> ev.preventDefault() + btn = $(this) + aid = btn[0].dataset.aId swal title: "Really delete?" text: "The question will be moved back to your inbox." @@ -7,10 +9,8 @@ $(document).on "click", "a[data-action=ab-destroy]", (ev) -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Delete" - closeOnConfirm: false + closeOnConfirm: true , -> - btn = $(this) - aid = btn[0].dataset.aId $.ajax url: '/ajax/destroy_answer' # TODO: find a way to use rake routes instead of hardcoding them here type: 'POST' diff --git a/app/assets/javascripts/answerbox/report.coffee b/app/assets/javascripts/answerbox/report.coffee index b3fec65c..266755b5 100644 --- a/app/assets/javascripts/answerbox/report.coffee +++ b/app/assets/javascripts/answerbox/report.coffee @@ -1,5 +1,7 @@ $(document).on "click", "a[data-action=ab-report]", (ev) -> ev.preventDefault() + btn = $(this) + aid = btn[0].dataset.aId swal title: "Really report?" text: "A moderator will review this answer and decide what happens." @@ -7,10 +9,8 @@ $(document).on "click", "a[data-action=ab-report]", (ev) -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Report" - closeOnConfirm: false + closeOnConfirm: true , -> - btn = $(this) - aid = btn[0].dataset.aId $.ajax url: '/ajax/report' # TODO: find a way to use rake routes instead of hardcoding them here type: 'POST' diff --git a/app/assets/javascripts/inbox.coffee b/app/assets/javascripts/inbox.coffee index 0e26742c..da9f9a0e 100644 --- a/app/assets/javascripts/inbox.coffee +++ b/app/assets/javascripts/inbox.coffee @@ -29,7 +29,7 @@ showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Delete" - closeOnConfirm: false + closeOnConfirm: true , -> btn.button "loading" succ = no @@ -92,6 +92,7 @@ $(document).on "click", "button[name=ib-answer]", -> $(document).on "click", "button[name=ib-destroy]", -> + btn = $(this) swal title: "Really delete?" text: "This question will be gone forever." @@ -99,9 +100,8 @@ $(document).on "click", "button[name=ib-destroy]", -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Delete" - closeOnConfirm: false + closeOnConfirm: true , -> - btn = $(this) btn.button "loading" iid = btn[0].dataset.ibId $("textarea[name=ib-answer][data-id=#{iid}]").attr "readonly", "readonly" diff --git a/app/assets/javascripts/moderation/comment.coffee b/app/assets/javascripts/moderation/comment.coffee index 23134c18..5fe965c0 100644 --- a/app/assets/javascripts/moderation/comment.coffee +++ b/app/assets/javascripts/moderation/comment.coffee @@ -68,6 +68,8 @@ $(document).on "input", "input[name=mod-comment-new]", (evt) -> # destroy $(document).on "click", "a[data-action=mod-comment-destroy]", (ev) -> ev.preventDefault() + btn = $(this) + cid = btn[0].dataset.id swal title: "Really delete?" text: "You will not be able to recover this comment." @@ -75,10 +77,8 @@ $(document).on "click", "a[data-action=mod-comment-destroy]", (ev) -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Delete" - closeOnConfirm: false + closeOnConfirm: true , -> - btn = $(this) - cid = btn[0].dataset.id $.ajax url: '/ajax/mod/destroy_comment' type: 'POST' diff --git a/app/assets/javascripts/moderation/destroy.coffee b/app/assets/javascripts/moderation/destroy.coffee index 5eae4ef5..cd52437e 100644 --- a/app/assets/javascripts/moderation/destroy.coffee +++ b/app/assets/javascripts/moderation/destroy.coffee @@ -1,4 +1,6 @@ $(document).on "click", "button[name=mod-delete-report]", -> + btn = $(this) + id = btn[0].dataset.id swal title: "Really delete?" text: "You will not be able to recover this report." @@ -6,10 +8,8 @@ $(document).on "click", "button[name=mod-delete-report]", -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Delete" - closeOnConfirm: false + closeOnConfirm: true , -> - btn = $(this) - id = btn[0].dataset.id $.ajax url: '/ajax/mod/destroy_report' type: 'POST' diff --git a/app/assets/javascripts/user.coffee b/app/assets/javascripts/user.coffee index 1a13f8ec..7ab8fd4d 100644 --- a/app/assets/javascripts/user.coffee +++ b/app/assets/javascripts/user.coffee @@ -58,7 +58,7 @@ $(document).on "click", "a[data-action=report-user]", (ev) -> showCancelButton: true confirmButtonColor: "#DD6B55" confirmButtonText: "Report" - closeOnConfirm: false + closeOnConfirm: true , -> $.ajax url: '/ajax/report'