Merged in feature/117-dev-dev01 (pull request #8)

auto-patch  117-dev-dev01-2023-12-15T16_09_06

* auto-patch  117-dev-dev01-2023-12-15T16_09_06
This commit is contained in:
Tony Volpe
2023-12-15 16:10:57 +00:00
parent 0825f6bd5f
commit 3dc9eca989
1424 changed files with 28118 additions and 10097 deletions

View File

@@ -54,8 +54,10 @@
events: {
'click .modal-close': 'closeButton',
'click #btn-ok' : 'addButton',
'click #btn-next' : 'nextButton',
'touchstart #btn-ok': 'addButton',
'keydown' : 'keyboardActions'
'keydown' : 'keyboardActions',
'input' : 'handleInputValidation'
},
resizeContent: function() {
var $content = $( '.wc-backbone-modal-content' ).find( 'article' );
@@ -94,9 +96,9 @@
$( document.body ).trigger( 'wc_backbone_modal_loaded', this._target );
},
closeButton: function( e ) {
closeButton: function( e, addButtonCalled ) {
e.preventDefault();
$( document.body ).trigger( 'wc_backbone_modal_before_remove', this._target );
$( document.body ).trigger( 'wc_backbone_modal_before_remove', [ this._target, this.getFormData(), !!addButtonCalled ] );
this.undelegateEvents();
$( document ).off( 'focusin' );
$( document.body ).css({
@@ -107,12 +109,21 @@
},
addButton: function( e ) {
$( document.body ).trigger( 'wc_backbone_modal_response', [ this._target, this.getFormData() ] );
this.closeButton( e );
this.closeButton( e, true );
},
getFormData: function() {
nextButton: function( e ) {
var context = this;
function closeModal() {
context.closeButton( e );
}
$( document.body ).trigger( 'wc_backbone_modal_next_response', [ this._target, this.getFormData(), closeModal ] );
},
getFormData: function( updating = true ) {
var data = {};
$( document.body ).trigger( 'wc_backbone_modal_before_update', this._target );
if ( updating ) {
$( document.body ).trigger( 'wc_backbone_modal_before_update', this._target );
}
$.each( $( 'form', this.$el ).serializeArray(), function( index, item ) {
if ( item.name.indexOf( '[]' ) !== -1 ) {
@@ -126,6 +137,9 @@
return data;
},
handleInputValidation: function() {
$( document.body ).trigger( 'wc_backbone_modal_validation', [ this._target, this.getFormData( false ) ] );
},
keyboardActions: function( e ) {
var button = e.keyCode || e.which;
@@ -134,7 +148,11 @@
13 === button &&
! ( e.target.tagName && ( e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea' ) )
) {
this.addButton( e );
if ( $( '#btn-ok' ).length ) {
this.addButton( e );
} else if ( $( '#btn-next' ).length ) {
this.nextButton( e );
}
}
// ESC key