mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-22 11:03:43 +03:00
Follow mockup for successful form submission
This commit is contained in:
parent
3133f0896a
commit
de07108905
|
@ -93,15 +93,19 @@ jQuery( document ).ready( function( $ ) {
|
||||||
},
|
},
|
||||||
success( response ) {
|
success( response ) {
|
||||||
if ( response.message ) {
|
if ( response.message ) {
|
||||||
|
// Say the message for screen reader users.
|
||||||
|
wp.a11y.speak( response.message );
|
||||||
|
|
||||||
|
if ( response.success ) {
|
||||||
|
closeModal();
|
||||||
|
$( button ).after( $( '<p>' ).html( '<em>' + response.message + '<em>' ) );
|
||||||
|
} else {
|
||||||
const $message = $( '<div>' )
|
const $message = $( '<div>' )
|
||||||
.addClass( 'notice notice-alt' )
|
.addClass( 'notice notice-alt' )
|
||||||
.addClass( response.success ? 'notice-success' : 'notice-error' )
|
.addClass( response.success ? 'notice-success' : 'notice-error' )
|
||||||
.append( $( '<p>' ).html( response.message ) );
|
.append( $( '<p>' ).html( response.message ) );
|
||||||
|
|
||||||
$( event.target.querySelector( '.message' ) ).html( $message );
|
$( event.target.querySelector( '.message' ) ).html( $message );
|
||||||
|
|
||||||
if ( response.success ) {
|
|
||||||
$( event.target.querySelector( 'input[type="submit"]' ) ).remove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -270,7 +270,7 @@ function enqueue_assets() {
|
||||||
|
|
||||||
if ( CPT_ID === get_post_type() ) {
|
if ( CPT_ID === get_post_type() ) {
|
||||||
$ver = filemtime( FiveForTheFuture\PATH . '/assets/js/frontend.js' );
|
$ver = filemtime( FiveForTheFuture\PATH . '/assets/js/frontend.js' );
|
||||||
wp_enqueue_script( '5ftf-frontend', plugins_url( 'assets/js/frontend.js', __DIR__ ), [ 'jquery', 'wp-util', 'wicg-inert' ], $ver, true );
|
wp_enqueue_script( '5ftf-frontend', plugins_url( 'assets/js/frontend.js', __DIR__ ), [ 'jquery', 'wp-a11y', 'wp-util', 'wicg-inert' ], $ver, true );
|
||||||
|
|
||||||
$script_data = [
|
$script_data = [
|
||||||
'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ), // The global ajaxurl is not set on the frontend.
|
'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ), // The global ajaxurl is not set on the frontend.
|
||||||
|
|
|
@ -31,7 +31,7 @@ defined( 'WPINC' ) || die();
|
||||||
value=""
|
value=""
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="message" role="alert" aria-atomic="true"></div>
|
<div class="message"></div>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="submit"
|
type="submit"
|
||||||
|
|
|
@ -63,7 +63,14 @@ body.single.single-5ftf_pledge {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-pledge-wrapper .button {
|
.edit-pledge-wrapper {
|
||||||
|
text-align: right;
|
||||||
|
|
||||||
|
p {
|
||||||
|
font-size: ms(-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
padding-right: 4px;
|
padding-right: 4px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: $color__wp-blue;
|
color: $color__wp-blue;
|
||||||
|
@ -73,6 +80,7 @@ body.single.single-5ftf_pledge {
|
||||||
border-bottom: 1px solid currentColor;
|
border-bottom: 1px solid currentColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@include breakpoint( $breakpoint-tablet ) {
|
@include breakpoint( $breakpoint-tablet ) {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
Loading…
Reference in a new issue