mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-02 01:01:18 +03:00
Rename generic "frontend" file to dialog
This commit is contained in:
parent
619af97bd1
commit
fa8bb48ad6
|
@ -1,4 +1,4 @@
|
||||||
/* global FiveForTheFuture, jQuery */
|
/* global FFTF_Dialog, jQuery */
|
||||||
jQuery( document ).ready( function( $ ) {
|
jQuery( document ).ready( function( $ ) {
|
||||||
const button = document.getElementById( 'toggle-management-link-form' );
|
const button = document.getElementById( 'toggle-management-link-form' );
|
||||||
const template = wp.template( '5ftf-send-link-dialog' );
|
const template = wp.template( '5ftf-send-link-dialog' );
|
||||||
|
@ -84,12 +84,12 @@ jQuery( document ).ready( function( $ ) {
|
||||||
$( event.target.querySelector( '.message' ) ).html( '' );
|
$( event.target.querySelector( '.message' ) ).html( '' );
|
||||||
$.ajax( {
|
$.ajax( {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: FiveForTheFuture.ajaxurl,
|
url: FFTF_Dialog.ajaxurl,
|
||||||
data: {
|
data: {
|
||||||
action: 'send-manage-email',
|
action: 'send-manage-email',
|
||||||
pledge_id: FiveForTheFuture.pledgeId,
|
pledge_id: FFTF_Dialog.pledgeId,
|
||||||
email,
|
email,
|
||||||
_ajax_nonce: FiveForTheFuture.ajaxNonce,
|
_ajax_nonce: FFTF_Dialog.ajaxNonce,
|
||||||
},
|
},
|
||||||
success( response ) {
|
success( response ) {
|
||||||
if ( response.message ) {
|
if ( response.message ) {
|
|
@ -462,21 +462,26 @@ function has_existing_pledge( $key, $key_type, int $current_pledge_id = 0 ) {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function enqueue_assets() {
|
function enqueue_assets() {
|
||||||
wp_register_script( 'wicg-inert', plugins_url( 'assets/js/inert.min.js', __DIR__ ), [], '3.0.0', true );
|
wp_register_script( 'wicg-inert', plugins_url( 'assets/js/inert.min.js', __DIR__ ), array(), '3.0.0', true );
|
||||||
|
|
||||||
if ( CPT_ID === get_post_type() ) {
|
if ( CPT_ID === get_post_type() ) {
|
||||||
$ver = filemtime( FiveForTheFuture\PATH . '/assets/js/frontend.js' );
|
wp_enqueue_script(
|
||||||
wp_enqueue_script( '5ftf-frontend', plugins_url( 'assets/js/frontend.js', __DIR__ ), [ 'jquery', 'wp-a11y', 'wp-util', 'wicg-inert' ], $ver, true );
|
'5ftf-dialog',
|
||||||
|
plugins_url( 'assets/js/dialog.js', __DIR__ ),
|
||||||
|
array( 'jquery', 'wp-a11y', 'wp-util', 'wicg-inert' ),
|
||||||
|
filemtime( FiveForTheFuture\PATH . '/assets/js/dialog.js' ),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
$script_data = [
|
$script_data = array(
|
||||||
'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.
|
||||||
'pledgeId' => get_the_ID(),
|
'pledgeId' => get_the_ID(),
|
||||||
'ajaxNonce' => wp_create_nonce( 'send-manage-email' ),
|
'ajaxNonce' => wp_create_nonce( 'send-manage-email' ),
|
||||||
];
|
);
|
||||||
wp_add_inline_script(
|
wp_add_inline_script(
|
||||||
'5ftf-frontend',
|
'5ftf-dialog',
|
||||||
sprintf(
|
sprintf(
|
||||||
'var FiveForTheFuture = JSON.parse( decodeURIComponent( \'%s\' ) );',
|
'var FFTF_Dialog = JSON.parse( decodeURIComponent( \'%s\' ) );',
|
||||||
rawurlencode( wp_json_encode( $script_data ) )
|
rawurlencode( wp_json_encode( $script_data ) )
|
||||||
),
|
),
|
||||||
'before'
|
'before'
|
||||||
|
|
Loading…
Reference in a new issue