Retrospring/app/javascript/packs/legacy/moderation/destroy.coffee

27 lines
909 B
CoffeeScript
Raw Normal View History

2014-12-28 15:21:06 -08:00
$(document).on "click", "button[name=mod-delete-report]", ->
2015-01-03 10:49:47 -08:00
btn = $(this)
id = btn[0].dataset.id
2015-01-03 08:36:55 -08:00
swal
2015-06-08 11:35:16 -07:00
title: translate('frontend.destroy_report.confirm.title')
text: translate('frontend.destroy_report.confirm.text')
2015-01-03 08:36:55 -08:00
type: "warning"
showCancelButton: true
confirmButtonColor: "#DD6B55"
2015-06-08 11:35:16 -07:00
confirmButtonText: translate('views.actions.delete')
cancelButtonText: translate('views.actions.cancel')
2015-01-03 10:49:47 -08:00
closeOnConfirm: true
2015-01-03 08:36:55 -08:00
, ->
2014-12-28 15:21:06 -08:00
$.ajax
url: '/ajax/mod/destroy_report'
type: 'POST'
data:
id: id
success: (data, status, jqxhr) ->
if data.success
$("div.moderationbox[data-id=#{id}]").slideUp()
showNotification data.message, data.success
error: (jqxhr, status, error) ->
console.log jqxhr, status, error
2015-06-08 11:35:16 -07:00
showNotification translate('frontend.error.message'), false
complete: (jqxhr, status) ->