Admin variations - Prompt when changing page #6995
This commit is contained in:
parent
d8b02456bc
commit
94aa610dc0
|
@ -258,9 +258,9 @@ jQuery( function( $ ) {
|
||||||
|
|
||||||
if ( 0 < need_update.length ) {
|
if ( 0 < need_update.length ) {
|
||||||
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_edited_variations ) ) {
|
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_edited_variations ) ) {
|
||||||
need_update.removeClass( 'variation-needs-update' );
|
wc_meta_boxes_product_variations_ajax.save_changes();
|
||||||
$( 'button.cancel-variation-changes, button.save-variation-changes' ).removeAttr( 'disabled' );
|
|
||||||
} else {
|
} else {
|
||||||
|
need_update.removeClass( 'variation-needs-update' );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -438,10 +438,7 @@ jQuery( function( $ ) {
|
||||||
* @return {bool}
|
* @return {bool}
|
||||||
*/
|
*/
|
||||||
add_variation: function() {
|
add_variation: function() {
|
||||||
if ( ! wc_meta_boxes_product_variations_ajax.check_for_changes() ) {
|
wc_meta_boxes_product_variations_ajax.check_for_changes();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wc_meta_boxes_product_variations_ajax.block();
|
wc_meta_boxes_product_variations_ajax.block();
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
|
@ -467,9 +464,7 @@ jQuery( function( $ ) {
|
||||||
* @return {bool}
|
* @return {bool}
|
||||||
*/
|
*/
|
||||||
remove_variation: function() {
|
remove_variation: function() {
|
||||||
if ( ! wc_meta_boxes_product_variations_ajax.check_for_changes() ) {
|
wc_meta_boxes_product_variations_ajax.check_for_changes();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_remove_variation ) ) {
|
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_remove_variation ) ) {
|
||||||
var variation = $( this ).attr( 'rel' ),
|
var variation = $( this ).attr( 'rel' ),
|
||||||
|
@ -506,9 +501,7 @@ jQuery( function( $ ) {
|
||||||
* @return {bool}
|
* @return {bool}
|
||||||
*/
|
*/
|
||||||
link_all_variations: function() {
|
link_all_variations: function() {
|
||||||
if ( ! wc_meta_boxes_product_variations_ajax.check_for_changes() ) {
|
wc_meta_boxes_product_variations_ajax.check_for_changes();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_link_all_variations ) ) {
|
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_link_all_variations ) ) {
|
||||||
wc_meta_boxes_product_variations_ajax.block();
|
wc_meta_boxes_product_variations_ajax.block();
|
||||||
|
@ -555,9 +548,7 @@ jQuery( function( $ ) {
|
||||||
* Bulk edit actions
|
* Bulk edit actions
|
||||||
*/
|
*/
|
||||||
bulk_edit: function() {
|
bulk_edit: function() {
|
||||||
if ( ! wc_meta_boxes_product_variations_ajax.check_for_changes() ) {
|
wc_meta_boxes_product_variations_ajax.check_for_changes();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bulk_edit = $( 'select#field_to_edit' ).val(),
|
var bulk_edit = $( 'select#field_to_edit' ).val(),
|
||||||
product_id = $( '#variable_product_options .woocommerce_variations' ).data( 'product_id' ),
|
product_id = $( '#variable_product_options .woocommerce_variations' ).data( 'product_id' ),
|
||||||
|
@ -713,7 +704,7 @@ jQuery( function( $ ) {
|
||||||
* @return {bool}
|
* @return {bool}
|
||||||
*/
|
*/
|
||||||
check_is_enabled: function( current ) {
|
check_is_enabled: function( current ) {
|
||||||
return ! $( current ).hasClass( 'disabled' ) && wc_meta_boxes_product_variations_ajax.check_for_changes();
|
return ! $( current ).hasClass( 'disabled' );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -752,8 +743,8 @@ jQuery( function( $ ) {
|
||||||
/**
|
/**
|
||||||
* Navigate on variations pages
|
* Navigate on variations pages
|
||||||
*
|
*
|
||||||
* @param {int} page
|
* @param {int} page
|
||||||
* @param {int} qty
|
* @param {int} qty
|
||||||
*/
|
*/
|
||||||
go_to_page: function( page, qty ) {
|
go_to_page: function( page, qty ) {
|
||||||
page = page || 1;
|
page = page || 1;
|
||||||
|
@ -770,12 +761,9 @@ jQuery( function( $ ) {
|
||||||
var selected = parseInt( $( this ).val(), 10 ),
|
var selected = parseInt( $( this ).val(), 10 ),
|
||||||
wrapper = $( '#variable_product_options .woocommerce_variations' );
|
wrapper = $( '#variable_product_options .woocommerce_variations' );
|
||||||
|
|
||||||
if ( wc_meta_boxes_product_variations_ajax.check_for_changes() ) {
|
wc_meta_boxes_product_variations_ajax.check_for_changes();
|
||||||
wc_meta_boxes_product_variations_pagenav.change_classes( selected, parseInt( wrapper.attr( 'data-total_pages' ), 10 ) );
|
wc_meta_boxes_product_variations_pagenav.change_classes( selected, parseInt( wrapper.attr( 'data-total_pages' ), 10 ) );
|
||||||
wc_meta_boxes_product_variations_ajax.load_variations( selected );
|
wc_meta_boxes_product_variations_ajax.load_variations( selected );
|
||||||
} else {
|
|
||||||
$( this ).val( parseInt( wrapper.attr( 'data-page' ), 10 ) );
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -185,7 +185,7 @@ class WC_Admin_Assets {
|
||||||
'i18n_remove_variation' => esc_js( __( 'Are you sure you want to remove this variation?', 'woocommerce' ) ),
|
'i18n_remove_variation' => esc_js( __( 'Are you sure you want to remove this variation?', 'woocommerce' ) ),
|
||||||
'i18n_scheduled_sale_start' => esc_js( __( 'Sale start date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
'i18n_scheduled_sale_start' => esc_js( __( 'Sale start date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
||||||
'i18n_scheduled_sale_end' => esc_js( __( 'Sale end date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
'i18n_scheduled_sale_end' => esc_js( __( 'Sale end date (YYYY-MM-DD format or leave blank)', 'woocommerce' ) ),
|
||||||
'i18n_edited_variations' => esc_js( __( 'You have some editions in your variations, data you have entered will not be saved if you continue.', 'woocommerce' ) ),
|
'i18n_edited_variations' => esc_js( __( 'Save changes before changing page?', 'woocommerce' ) ),
|
||||||
'i18n_item' => esc_js( __( '%qty% item', 'woocommerce' ) ),
|
'i18n_item' => esc_js( __( '%qty% item', 'woocommerce' ) ),
|
||||||
'i18n_items' => esc_js( __( '%qty% items', 'woocommerce' ) ),
|
'i18n_items' => esc_js( __( '%qty% items', 'woocommerce' ) ),
|
||||||
'variations_per_page' => absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 10 ) )
|
'variations_per_page' => absint( apply_filters( 'woocommerce_admin_meta_boxes_variations_per_page', 10 ) )
|
||||||
|
|
Loading…
Reference in New Issue