Skip to content

Commit

Permalink
Merge branch 'develop' into release/3.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Waldstein committed May 7, 2024
2 parents 6dac949 + 2d0b076 commit 80054d0
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 97 deletions.
57 changes: 30 additions & 27 deletions src/DonationForms/V2/DonationFormsAdminPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public function loadScripts()
'table' => give(DonationFormsListTable::class)->toArray(),
'adminUrl' => $this->adminUrl,
'pluginUrl' => GIVE_PLUGIN_URL,
'showBanner' => ! get_user_meta(get_current_user_id(), 'givewp-show-onboarding-banner', true),
'showUpgradedTooltip' => ! get_user_meta(get_current_user_id(), 'givewp-show-upgraded-tooltip', true),
'showBanner' => !get_user_meta(get_current_user_id(), 'givewp-show-onboarding-banner', true),
'showUpgradedTooltip' => !get_user_meta(get_current_user_id(), 'givewp-show-upgraded-tooltip', true),
'supportedAddons' => $this->getSupportedAddons(),
'supportedGateways' => $this->getSupportedGateways(),
];
Expand Down Expand Up @@ -133,29 +133,29 @@ public function loadMigrationScripts()
{
if ($this->isShowingAddV2FormPage()) {
EnqueueScript::make('give-add-v2form', 'assets/dist/js/give-add-v2form.js')
->loadInFooter()
->registerTranslations()
->registerLocalizeData('GiveDonationForms', [
'supportedAddons' => $this->getSupportedAddons(),
'supportedGateways' => $this->getSupportedGateways(),
])
->enqueue();
->loadInFooter()
->registerTranslations()
->registerLocalizeData('GiveDonationForms', [
'supportedAddons' => $this->getSupportedAddons(),
'supportedGateways' => $this->getSupportedGateways(),
])
->enqueue();

wp_enqueue_style('givewp-design-system-foundation');
}

if ($this->isShowingEditV2FormPage()) {
EnqueueScript::make('give-edit-v2form', 'assets/dist/js/give-edit-v2form.js')
->loadInFooter()
->registerTranslations()
->registerLocalizeData('GiveDonationForms', [
'supportedAddons' => $this->getSupportedAddons(),
'supportedGateways' => $this->getSupportedGateways(),
'migrationApiRoot' => $this->migrationApiRoot,
'apiNonce' => $this->apiNonce,
'isMigrated' => _give_is_form_migrated((int)$_GET['post'])
])
->enqueue();
->loadInFooter()
->registerTranslations()
->registerLocalizeData('GiveDonationForms', [
'supportedAddons' => $this->getSupportedAddons(),
'supportedGateways' => $this->getSupportedGateways(),
'migrationApiRoot' => $this->migrationApiRoot,
'apiNonce' => $this->apiNonce,
'isMigrated' => _give_is_form_migrated((int)$_GET['post']),
])
->enqueue();

wp_enqueue_style('givewp-design-system-foundation');
}
Expand Down Expand Up @@ -215,7 +215,7 @@ public function render()
*
* @since 3.0.0
*
* @param WP_Post $post
* @param WP_Post $post
*
* @return void
*/
Expand All @@ -239,17 +239,20 @@ function showReactTable() {
fetch('<?php echo esc_url_raw(rest_url('give-api/v2/admin/forms/view?isLegacy=0')) ?>', {
method: 'GET',
headers: {
['X-WP-Nonce']: '<?php echo wp_create_nonce('wp_rest') ?>',
},
['X-WP-Nonce']: '<?php echo wp_create_nonce('wp_rest') ?>'
}
})
.then((res) => {
window.location = window.location.href = '/wp-admin/edit.php?post_type=give_forms&page=give-forms';
});
}

jQuery(function () {
jQuery(jQuery(".wrap .page-title-action")[0]).after(
'<button class="page-title-action" onclick="showReactTable()"><?php _e('Switch to New View', 'give') ?></button>',
jQuery(function() {
jQuery(jQuery('.wrap .page-title-action')[0]).after(
'<button class="page-title-action" onclick="showReactTable()"><?php _e(
'Switch to New View',
'give'
) ?></button>'
);
});
</script>
Expand Down Expand Up @@ -288,7 +291,7 @@ private function isShowingEditV2FormPage(): bool
*/
private function isShowingAddV2FormPage(): bool
{
return ! isset($_GET['page']) && isset($_GET['post_type']) && $_GET['post_type'] === 'give_forms';
return !isset($_GET['page']) && isset($_GET['post_type']) && $_GET['post_type'] === 'give_forms';
}

/**
Expand Down Expand Up @@ -340,7 +343,6 @@ public function getSupportedAddons(): array
'Funds' => defined('GIVE_FUNDS_ADDON_NAME'),
'Peer-to-Peer' => defined('GIVE_P2P_NAME'),
'Gift Aid' => class_exists('Give_Gift_Aid'),
// 'MailChimp' => class_exists('Give_MailChimp'),
// 'Text-to-Give' => defined('GIVE_TEXT_TO_GIVE_ADDON_NAME'),
// 'Donation Block for Stripe' => defined('DONATION_BLOCK_FILE'),
'Double the Donation' => defined('GIVE_DTD_NAME'),
Expand All @@ -349,6 +351,7 @@ public function getSupportedAddons(): array
'Per Form Gateways' => class_exists('Give_Per_Form_Gateways'),
// 'Per Form Confirmations' => class_exists('Per_Form_Confirmations_4_GIVEWP'),
// 'Form Countdown' => class_exists('Give_Form_Countdown'),
'ConvertKit' => defined('GIVE_CONVERTKIT_VERSION'),
'ActiveCampaign' => class_exists('Give_ActiveCampaign'),
];

Expand Down
Loading

0 comments on commit 80054d0

Please sign in to comment.