mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-12 21:35:44 +03:00
Pledge Management: Allow pledge admins to remove the pledge (#123)
* Rename generic "frontend" file to dialog * Add a "remove pledge" action * Process pledge deactivation * Trigger an email on user-initiated pledge deactivation * Show an error when trying to manage a deactivated pledge * Add a label for "deactivated" pledges
This commit is contained in:
parent
619af97bd1
commit
bdbf6d573e
11 changed files with 184 additions and 26 deletions
|
@ -1,4 +1,4 @@
|
|||
/* global ajaxurl, FiveForTheFuture, fftfContributors, jQuery */
|
||||
/* global FiveForTheFuture, fftfContributors, jQuery */
|
||||
/* eslint no-alert: "off" */
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
let ajaxurl = window.ajaxurl;
|
||||
|
@ -153,4 +153,10 @@ jQuery( document ).ready( function( $ ) {
|
|||
_addContributors();
|
||||
}
|
||||
} );
|
||||
|
||||
$( '#5ftf-pledge-remove' ).on( 'click', function( event ) {
|
||||
if ( ! confirm( FiveForTheFuture.removePrompt ) ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* global FiveForTheFuture, jQuery */
|
||||
/* global FFTF_Dialog, jQuery */
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
const button = document.getElementById( 'toggle-management-link-form' );
|
||||
const template = wp.template( '5ftf-send-link-dialog' );
|
||||
|
@ -84,12 +84,12 @@ jQuery( document ).ready( function( $ ) {
|
|||
$( event.target.querySelector( '.message' ) ).html( '' );
|
||||
$.ajax( {
|
||||
type: 'POST',
|
||||
url: FiveForTheFuture.ajaxurl,
|
||||
url: FFTF_Dialog.ajaxurl,
|
||||
data: {
|
||||
action: 'send-manage-email',
|
||||
pledge_id: FiveForTheFuture.pledgeId,
|
||||
pledge_id: FFTF_Dialog.pledgeId,
|
||||
email,
|
||||
_ajax_nonce: FiveForTheFuture.ajaxNonce,
|
||||
_ajax_nonce: FFTF_Dialog.ajaxNonce,
|
||||
},
|
||||
success( response ) {
|
||||
if ( response.message ) {
|
Loading…
Add table
Add a link
Reference in a new issue