Use blockui while saving taxes
This commit is contained in:
parent
7adafc77c9
commit
a81f0f6eea
|
@ -62,21 +62,44 @@
|
|||
|
||||
return rates;
|
||||
},
|
||||
save: function() {
|
||||
$.post( ajaxurl + '?action=woocommerce_tax_rates_save_changes', {
|
||||
current_class : data.current_class,
|
||||
wc_tax_nonce : data.wc_tax_nonce,
|
||||
changes : this.changes
|
||||
}, this.onSaveResponse, 'json' );
|
||||
block: function() {
|
||||
$( '.wc_tax_rates' ).block({
|
||||
message: null,
|
||||
overlayCSS: {
|
||||
background: '#fff',
|
||||
opacity: 0.6
|
||||
}
|
||||
});
|
||||
},
|
||||
onSaveResponse: function( response, textStatus ) {
|
||||
if ( 'success' === textStatus ) {
|
||||
WCTaxTableModelInstance.set( 'rates', response.data.rates );
|
||||
WCTaxTableModelInstance.trigger( 'change:rates' );
|
||||
unblock: function() {
|
||||
$( '.wc_tax_rates' ).unblock();
|
||||
},
|
||||
save: function() {
|
||||
var self = this;
|
||||
|
||||
WCTaxTableModelInstance.changes = {};
|
||||
WCTaxTableModelInstance.trigger( 'saved:rates' );
|
||||
}
|
||||
self.block();
|
||||
|
||||
Backbone.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: ajaxurl + '?action=woocommerce_tax_rates_save_changes',
|
||||
data: {
|
||||
current_class: data.current_class,
|
||||
wc_tax_nonce: data.wc_tax_nonce,
|
||||
changes: self.changes
|
||||
},
|
||||
success: function( response, textStatus ) {
|
||||
if ( 'success' === textStatus ) {
|
||||
WCTaxTableModelInstance.set( 'rates', response.data.rates );
|
||||
WCTaxTableModelInstance.trigger( 'change:rates' );
|
||||
|
||||
WCTaxTableModelInstance.changes = {};
|
||||
WCTaxTableModelInstance.trigger( 'saved:rates' );
|
||||
}
|
||||
|
||||
self.unblock();
|
||||
}
|
||||
});
|
||||
}
|
||||
} ),
|
||||
WCTaxTableViewConstructor = Backbone.View.extend({
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -101,7 +101,7 @@ class WC_Admin_Assets {
|
|||
wp_register_script( 'flot-time', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.time' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
|
||||
wp_register_script( 'flot-pie', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.pie' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
|
||||
wp_register_script( 'flot-stack', WC()->plugin_url() . '/assets/js/jquery-flot/jquery.flot.stack' . $suffix . '.js', array( 'jquery', 'flot' ), WC_VERSION );
|
||||
wp_register_script( 'wc-settings-tax', WC()->plugin_url() . '/assets/js/admin/settings-views-html-settings-tax' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone' ), WC_VERSION );
|
||||
wp_register_script( 'wc-settings-tax', WC()->plugin_url() . '/assets/js/admin/settings-views-html-settings-tax' . $suffix . '.js', array( 'jquery', 'wp-util', 'underscore', 'backbone', 'jquery-blockui' ), WC_VERSION );
|
||||
|
||||
// Chosen is @deprecated (2.3) in favour of select2, but is registered for backwards compat
|
||||
wp_register_script( 'ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array( 'jquery', 'chosen' ), WC_VERSION );
|
||||
|
|
Loading…
Reference in New Issue