PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.8
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.8
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 1.7.0.9 1.8.0 All 210 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.6.8, at templates/campaign-loop/donate-modal-window.php

78 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 Studio 164a
8 * @since 1.0.0
9 * @version 1.3.2
10 */
11
12 $modal_class = apply_filters( 'charitable_modal_window_class', 'charitable-modal' );
13
14 wp_print_scripts( 'lean-modal' );
15 wp_enqueue_style( 'lean-modal-css' );
16 ?>
17 <div id="charitable-donation-form-modal-loop" style="display: none;" class="<?php echo esc_attr( $modal_class ) ?>">
18 <a class="modal-close"></a>
19 <div class="donation-form-wrapper"></div>
20 </div>
21 <script type="text/javascript">
22 ( function( $ ) {
23 var resize_modal = function(){
24 $.fn.leanModal( 'resize', $('#charitable-donation-form-modal-loop') );
25 };
26
27 $( '[data-trigger-modal]' ).on( 'click', function(){
28 var campaign_id = $( this ).data( 'campaign-id' ),
29 $wrapper = $( '#charitable-donation-form-modal-loop .donation-form-wrapper' );
30
31 if ( ! campaign_id ) {
32 return;
33 }
34
35 $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' ) ?>\" />" );
36
37 resize_modal();
38
39 $.ajax({
40 type: "POST",
41 data: {
42 action : 'get_donation_form',
43 campaign_id : campaign_id
44 },
45 dataType: "json",
46 url: CHARITABLE_VARS.ajaxurl,
47 xhrFields: {
48 withCredentials: true
49 },
50 success: function ( response ) {
51 if ( response.success ) {
52 $wrapper.html( response.data );
53
54 new CHARITABLE.Donation_Form( $wrapper.find( '#charitable-donation-form' ) );
55
56 CHARITABLE.Toggle();
57
58 resize_modal();
59
60 return;
61 }
62
63 $wrapper.html( "<?php _e( 'Unfortunately, something went wrong while trying to retrieve the donation form. Please reload the page and try again.', 'charitable' ) ?>" );
64 },
65 error: function() {
66 $wrapper.html( "<?php _e( 'Unfortunately, something went wrong while trying to retrieve the donation form. Please reload the page and try again.', 'charitable' ) ?>" );
67 }
68 }).fail(function ( response ) {
69 if ( window.console && window.console.log ) {
70 console.log( response );
71 }
72 });
73
74 return false;
75 });
76 })( jQuery );
77 </script>
78