Merge pull request #10907 from corsonr/confirm_delete_order_note

Add order note deletion confirmation
This commit is contained in:
Mike Jolley 2016-05-12 12:26:26 +01:00
commit 5f46f60cb0
2 changed files with 25 additions and 22 deletions

View File

@ -1189,27 +1189,29 @@ jQuery( function ( $ ) {
},
delete_order_note: function() {
var note = $( this ).closest( 'li.note' );
$( note ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var data = {
action: 'woocommerce_delete_order_note',
note_id: $( note ).attr( 'rel' ),
security: woocommerce_admin_meta_boxes.delete_order_note_nonce
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function() {
$( note ).remove();
});
return false;
if ( window.confirm( woocommerce_admin_meta_boxes.i18n_delete_note ) ) {
var note = $( this ).closest( 'li.note' );
$( note ).block({
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6
}
});
var data = {
action: 'woocommerce_delete_order_note',
note_id: $( note ).attr( 'rel' ),
security: woocommerce_admin_meta_boxes.delete_order_note_nonce
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function() {
$( note ).remove();
});
return false;
}
}
};

View File

@ -283,7 +283,8 @@ class WC_Admin_Assets {
'i18n_download_permission_fail' => __( 'Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce' ),
'i18n_permission_revoke' => __( 'Are you sure you want to revoke access to this download?', 'woocommerce' ),
'i18n_tax_rate_already_exists' => __( 'You cannot add the same tax rate twice!', 'woocommerce' ),
'i18n_product_type_alert' => __( 'Your product has variations! Before changing the product type, it is a good idea to delete the variations to avoid errors in the stock reports.', 'woocommerce' )
'i18n_product_type_alert' => __( 'Your product has variations! Before changing the product type, it is a good idea to delete the variations to avoid errors in the stock reports.', 'woocommerce' ),
'i18n_delete_note' => __( 'Are you sure you wish to delete this note? This action cannot be undone.', 'woocommerce' )
);
wp_localize_script( 'wc-admin-meta-boxes', 'woocommerce_admin_meta_boxes', $params );