Sha256: bc22e9e4b7eff70793de6d21564056ba6e8dd7d014cd0699876e40bc8bd4437f

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

var slice = [].slice;

$(window).on('page:load load ajax:success', function() {
return $('a[data-delete-link]').on('click', function(e) {
  var redirect, url;
url = $(this).data('delete-link');
redirect = (function(_this) {
  return function() {
    if (url = $(_this).data('after-delete-redirection')) {
      return window.location.href = url;
} else {
return location.reload();
}
};
})(this);
swal({
  title: 'Are you sure?',
  text: 'This action cannot be undone!',
  type: 'warning',
  showCancelButton: true,
  confirmButtonColor: '#DD6B55',
  confirmButtonText: 'Yes, delete it!',
  closeOnConfirm: false,
  showLoaderOnConfirm: true
}, function() {
return $.ajax({
  url: url,
  method: 'POST',
  data: {
    _method: 'DELETE'
  },
  success: function() {
    var x;
x = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return swal({
  title: 'Deleted!',
  text: 'Its been deleted.',
  type: 'success'
}, redirect);
},
error: function() {
return swal({
  title: 'Error!',
  text: 'Sorry a problem has occurred',
  type: 'error'
});
}
});
});
return e.preventDefault();
});
});

// ---
// generated by coffee-script 1.9.2

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cd2_catton_cms-1.1.35 app/assets/javascripts/c/confirm_delete.js
cd2_catton_cms-1.1.34 app/assets/javascripts/c/confirm_delete.js
cd2_catton_cms-1.1.33 app/assets/javascripts/c/confirm_delete.js
cd2_catton_cms-1.1.32 app/assets/javascripts/c/confirm_delete.js
cd2_catton_cms-1.1.31 app/assets/javascripts/c/confirm_delete.js
cd2_catton_cms-1.1.30 app/assets/javascripts/c/confirm_delete.js
cd2_catton_cms-1.1.20 app/assets/javascripts/c/confirm_delete.js
cd2_catton_cms-1.1.10 app/assets/javascripts/c/confirm_delete.js