PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.14
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.14
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / templates / campaign-loop / donate-modal-window.php

donate-modal-window.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0.14, at templates/campaign-loop/donate-modal-window.php

79 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Sets up the modal window for the campaigns in the loop.
4 *
5 * Override this template by copying it to yourtheme/charitable/campaign-loop/donate-modal-window.php
6 *
7 * @author WP Charitable LLC
8 * @package Charitable/Templates/Campaign
9 * @since 1.0.0
10 * @version 1.6.57
11 */
12
13 $modal_class = apply_filters( 'charitable_modal_window_class', 'charitable-modal' );
14
15 wp_enqueue_script( 'lean-modal' );
16 wp_enqueue_style( 'lean-modal-css' );
17 ?>
18 <div id="charitable-donation-form-modal-loop" style="display: none;" class="<?php echo esc_attr( $modal_class ); ?>">
19 <a class="modal-close"></a>
20 <div class="donation-form-wrapper"></div>
21 </div>
22 <script type="text/javascript">
23 ( function( $ ) {
24 var resize_modal = function(){
25 $.fn.leanModal( 'resize', $('#charitable-donation-form-modal-loop') );
26 };
27
28 $( '[data-trigger-modal]' ).on( 'click', function(){
29 var campaign_id = $( this ).data( 'campaign-id' ),
30 $wrapper = $( '#charitable-donation-form-modal-loop .donation-form-wrapper' );
31
32 if ( ! campaign_id ) {
33 return;
34 }
35
36 $wrapper.html( "<img src=\"<?php echo charitable()->get_path( 'assets', false ); ?>/images/charitable-loading.gif\" width=\"60\" height=\"60\" alt=\"<?php esc_attr_e( 'Loading&hellip;', 'charitable' ); ?>\" />" );
37
38 resize_modal();
39
40 $.ajax({
41 type: "POST",
42 data: {
43 action: 'get_donation_form',
44 campaign_id: campaign_id
45 },
46 dataType: "json",
47 url: CHARITABLE_VARS.ajaxurl,
48 xhrFields: {
49 withCredentials: true
50 },
51 success: function ( response ) {
52 if ( response.success ) {
53 $wrapper.html( response.data );
54
55 new CHARITABLE.Donation_Form( $wrapper.find( '#charitable-donation-form' ) );
56
57 CHARITABLE.Toggle();
58
59 resize_modal();
60
61 return;
62 }
63
64 $wrapper.html( "<?php _e( 'Unfortunately, something went wrong while trying to retrieve the donation form. Please reload the page and try again.', 'charitable' ); ?>" );
65 },
66 error: function() {
67 $wrapper.html( "<?php _e( 'Unfortunately, something went wrong while trying to retrieve the donation form. Please reload the page and try again.', 'charitable' ); ?>" );
68 }
69 }).fail(function ( response ) {
70 if ( window.console && window.console.log ) {
71 console.log( response );
72 }
73 });
74
75 return false;
76 });
77 })( jQuery );
78 </script>
79