Merged in feature/280-dev-dev01 (pull request #21)
auto-patch 280-dev-dev01-2024-01-19T16_41_58 * auto-patch 280-dev-dev01-2024-01-19T16_41_58
This commit is contained in:
@@ -103,6 +103,7 @@
|
||||
$( document.body ).on( 'wc_region_picker_update', this.onUpdateZoneRegionPicker );
|
||||
$( document.body ).on( 'wc_backbone_modal_next_response', this.onAddShippingMethodSubmitted );
|
||||
$( document.body ).on( 'wc_backbone_modal_before_remove', this.onCloseConfigureShippingMethod );
|
||||
$( document.body ).on( 'wc_backbone_modal_back_response', this.onConfigureShippingMethodBack );
|
||||
$( document.body ).on( 'change', '.wc-shipping-zone-method-selector select', this.onChangeShippingMethodSelector );
|
||||
$( document.body ).on( 'click', '.wc-shipping-zone-postcodes-toggle', this.onTogglePostcodes );
|
||||
$( document.body ).on( 'wc_backbone_modal_validation', { view: this }, this.validateFormArguments );
|
||||
@@ -344,6 +345,8 @@
|
||||
}
|
||||
});
|
||||
|
||||
shippingMethodView.highlightOnFocus( '.wc-shipping-modal-price' );
|
||||
|
||||
$( document.body ).trigger( 'init_tooltips' );
|
||||
},
|
||||
onConfigureShippingMethodSubmitted: function( event, target, posted_data ) {
|
||||
@@ -382,6 +385,11 @@
|
||||
);
|
||||
}
|
||||
},
|
||||
onConfigureShippingMethodBack: function( event, target ) {
|
||||
if ( 'wc-modal-shipping-method-settings' === target ) {
|
||||
shippingMethodView.onAddShippingMethod( event );
|
||||
}
|
||||
},
|
||||
showErrors: function( errors ) {
|
||||
var error_html = '<div id="woocommerce_errors" class="error notice is-dismissible">';
|
||||
|
||||
@@ -392,6 +400,12 @@
|
||||
|
||||
$( 'table.wc-shipping-zone-methods' ).before( error_html );
|
||||
},
|
||||
highlightOnFocus: function( query ) {
|
||||
const inputs = $( query );
|
||||
inputs.focus( function() {
|
||||
$( this ).select();
|
||||
} );
|
||||
},
|
||||
onAddShippingMethod: function( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -403,6 +417,15 @@
|
||||
});
|
||||
|
||||
$( '.wc-shipping-zone-method-selector select' ).trigger( 'change' );
|
||||
|
||||
$('.wc-shipping-zone-method-input input').change( function() {
|
||||
const selected = $('.wc-shipping-zone-method-input input:checked');
|
||||
const id = selected.attr( 'id' );
|
||||
const description = $( `#${ id }-description` );
|
||||
const descriptions = $( '.wc-shipping-zone-method-input-help-text' );
|
||||
descriptions.css( 'display', 'none' );
|
||||
description.css( 'display', 'block' );
|
||||
});
|
||||
},
|
||||
/**
|
||||
* The settings HTML is controlled and built by the settings api, so in order to refactor the
|
||||
@@ -501,14 +524,15 @@
|
||||
return htmlContent.prop( 'outerHTML' );
|
||||
},
|
||||
replaceHTMLTables: function ( html ) {
|
||||
// Wrap the html content in a div
|
||||
const htmlContent = $( '<div>' + html + '</div>' );
|
||||
|
||||
// `<table class="form-table" />` elements added by the Settings API need to be removed.
|
||||
// Modern browsers won't interpret other table elements like `td` not in a `table`, so
|
||||
// Removing the `table` is sufficient.
|
||||
const htmlContent = $( html );
|
||||
const tables = htmlContent.find( 'table.form-table' );
|
||||
|
||||
tables.each( ( i ) => {
|
||||
const table = $( tables[ i ] );
|
||||
const innerTables = htmlContent.find( 'table.form-table' );
|
||||
innerTables.each( ( i ) => {
|
||||
const table = $( innerTables[ i ] );
|
||||
const div = $( '<div class="wc-shipping-zone-method-fields" />' );
|
||||
div.html( table.html() );
|
||||
table.replaceWith( div );
|
||||
@@ -520,7 +544,7 @@
|
||||
if ( 'wc-modal-add-shipping-method' === target ) {
|
||||
shippingMethodView.block();
|
||||
|
||||
$('#btn-next').html('<img alt="processing" src="images/wpspin_light.gif" class="waiting" />');
|
||||
$('#btn-next').addClass( 'is-busy' );
|
||||
|
||||
// Add method to zone via ajax call
|
||||
$.post( ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?' ) + 'action=woocommerce_shipping_zone_add_method', {
|
||||
@@ -569,6 +593,8 @@
|
||||
status : 'new'
|
||||
}
|
||||
});
|
||||
|
||||
shippingMethodView.highlightOnFocus( '.wc-shipping-modal-price' );
|
||||
} else {
|
||||
shippingMethodView.model.trigger( 'change:methods' );
|
||||
shippingMethodView.model.trigger( 'saved:methods' );
|
||||
|
||||
Reference in New Issue
Block a user