Skip to content

Commit 48f520f

Browse files
authored
Merge branch 'epic/campaigns' into feature/campaign-block-GIVE-1388
2 parents 75e24c7 + 73b8661 commit 48f520f

File tree

56 files changed

+665
-340
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+665
-340
lines changed

.github/workflows/wordpress.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
5353
- uses: actions/checkout@v2
5454
- name: Cache dependencies
55-
uses: actions/cache@v1
55+
uses: actions/cache@v3
5656
with:
5757
path: ~/.composer/cache/files
5858
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

assets/src/css/admin/_components.admin-header.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
.post-type-give_forms,
66
.give_forms_page_give-subscriptions {
77

8+
.page-title-action:not(.switch-new-view) {
9+
display: none;
10+
}
11+
812
.wp-header-end + .notice {
913
margin-top: 11px;
1014
}
Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,82 @@
11
// Dependencies
2-
import { useState, Fragment } from 'react';
3-
import { __ } from '@wordpress/i18n'
4-
import { getWindowData } from '../../utils';
2+
import {Fragment, useState} from 'react';
3+
import {__} from '@wordpress/i18n';
4+
import {getWindowData} from '../../utils';
55

66
// Store-related dependencies
7-
import { useStoreValue } from '../../store';
8-
import { disablePeriodSelector } from '../../store/actions';
7+
import {useStoreValue} from '../../store';
8+
import {disablePeriodSelector} from '../../store/actions';
99

1010
// Styles
1111
import './style.scss';
1212

13-
const NoDataNotice = ( { version } ) => {
14-
const [ {}, dispatch ] = useStoreValue();
13+
const NoDataNotice = ({version}) => {
14+
const [{}, dispatch] = useStoreValue();
1515

16-
const [ showNotice, setShowNotice ] = useState( true );
16+
const [showNotice, setShowNotice] = useState(true);
1717

18-
const loadSampleData = () => {
19-
setShowNotice( false );
20-
dispatch( disablePeriodSelector() );
21-
};
18+
const loadSampleData = () => {
19+
setShowNotice(false);
20+
dispatch(disablePeriodSelector());
21+
};
2222

23-
const goToNewFormUrl = () => {
24-
const url = getWindowData( 'newFormUrl' );
25-
window.location = url;
26-
};
23+
const goToNewFormUrl = () => {
24+
const url = getWindowData('newFormUrl');
25+
window.location = url;
26+
};
2727

28-
return (
29-
<Fragment>
30-
{ showNotice && (
31-
<div className="givewp-not-found-notice">
32-
<div className="givewp-not-found-card">
33-
{ version === 'dashboard' ? (
34-
<Fragment>
35-
<h2>{ __( 'Get a quick view of your', 'give' ) }<br />{ __( 'donation activity', 'give' ) }</h2>
36-
<p>
37-
{ __( 'It looks like there hasn\'t been any donations yet on your website.', 'give' ) } <br />
38-
{ __( 'Set up a donation form to begin collecting donations now.', 'give' ) } <br />
39-
</p>
40-
<button
41-
onClick={ () => goToNewFormUrl() }
42-
className="givewp-not-found-notice-button">
43-
{ __( 'Create a Donation Form', 'give' ) }
44-
</button>
45-
</Fragment>
46-
) : (
47-
<Fragment>
48-
<h2>{ __( 'Get a detailed view of your', 'give' ) }<br />{ __( 'donation activity', 'give' ) }</h2>
49-
<p>
50-
{ __( 'It looks like there hasn\'t been any donations yet on your website. ', 'give' ) } <br />
51-
{ __( 'Set up a donation form to begin collection donations or load some sample data to preview what the reports look like.', 'give' ) } <br />
52-
</p>
53-
<button
54-
onClick={ () => loadSampleData() }
55-
className="givewp-not-found-notice-button">
56-
{ __( 'Explore Sample Reports', 'give' ) }
57-
</button>
58-
</Fragment>
59-
) }
60-
</div>
61-
</div>
62-
) }
63-
</Fragment>
64-
);
28+
return (
29+
<Fragment>
30+
{showNotice && (
31+
<div className="givewp-not-found-notice">
32+
<div className="givewp-not-found-card">
33+
{version === 'dashboard' ? (
34+
<Fragment>
35+
<h2>
36+
{__('Get a quick view of your', 'give')}
37+
<br />
38+
{__('donation activity', 'give')}
39+
</h2>
40+
<p>
41+
{__("It looks like there hasn't been any donations yet on your website.", 'give')}{' '}
42+
<br />
43+
{__('Set up a campaign form to begin collecting donations now.', 'give')}
44+
<br />
45+
</p>
46+
<button onClick={() => goToNewFormUrl()} className="givewp-not-found-notice-button">
47+
{__('Create a Campaign Form', 'give')}
48+
</button>
49+
</Fragment>
50+
) : (
51+
<Fragment>
52+
<h2>
53+
{__('Get a detailed view of your', 'give')}
54+
<br />
55+
{__('donation activity', 'give')}
56+
</h2>
57+
<p>
58+
{__("It looks like there hasn't been any donations yet on your website. ", 'give')}{' '}
59+
<br />
60+
{__(
61+
'Set up a campaign form to begin collection donations or load some sample data to preview what the reports look like.',
62+
'give'
63+
)}{' '}
64+
<br />
65+
</p>
66+
<button onClick={() => loadSampleData()} className="givewp-not-found-notice-button">
67+
{__('Explore Sample Reports', 'give')}
68+
</button>
69+
</Fragment>
70+
)}
71+
</div>
72+
</div>
73+
)}
74+
</Fragment>
75+
);
6576
};
6677

6778
NoDataNotice.defaultProps = {
68-
version: 'app',
79+
version: 'app',
6980
};
7081

7182
export default NoDataNotice;

blocks/components/no-form/index.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,38 @@
11
/**
22
* WordPress dependencies
33
*/
4-
import { __ } from '@wordpress/i18n'
5-
import { Button } from '@wordpress/components';
4+
import {__} from '@wordpress/i18n';
5+
import {Button} from '@wordpress/components';
66

77
/**
88
* Internal dependencies
99
*/
10-
import { getSiteUrl } from '../../utils';
10+
import {getSiteUrl} from '../../utils';
1111
import GiveBlankSlate from '../blank-slate';
1212

1313
/**
1414
* Render No forms Found UI
15-
*/
15+
*
16+
* @unreleased Replace "new form" with "new campaign form" link
17+
*/
1618

1719
const NoForms = () => {
18-
return (
19-
<GiveBlankSlate title={ __( 'No donation forms found.', 'give' ) }
20-
description={ __( 'The first step towards accepting online donations is to create a form.', 'give' ) }
21-
helpLink>
22-
<Button
23-
isPrimary
24-
isLarge
25-
className="give-blank-slate__cta"
26-
href={ `${ getSiteUrl() }/wp-admin/post-new.php?post_type=give_forms` }>
27-
{ __( 'Create Donation Form', 'give' ) }
28-
</Button>
29-
</GiveBlankSlate>
30-
);
20+
return (
21+
<GiveBlankSlate
22+
title={__('No campaign forms found.', 'give')}
23+
description={__('The first step towards accepting online donations is to create a campaign.', 'give')}
24+
helpLink
25+
>
26+
<Button
27+
isPrimary
28+
isLarge
29+
className="give-blank-slate__cta"
30+
href={`${getSiteUrl()}/wp-admin/edit.php?post_type=give_forms&page=give-campaigns&new=campaign`}
31+
>
32+
{__('Create Campaign Form', 'give')}
33+
</Button>
34+
</GiveBlankSlate>
35+
);
3136
};
3237

3338
export default NoForms;

blocks/donation-form-grid/class-give-donation-form-grid-block.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ private function getAsArray($value) {
270270
/**
271271
* Return formatted notice when shortcode return empty string
272272
*
273+
* @unreleased Replace "new form" with "new campaign form" link
273274
* @since 2.4.0
274275
*
275276
* @return string
@@ -284,10 +285,11 @@ private function blank_slate() {
284285
$content = array(
285286
'image_url' => GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg',
286287
'image_alt' => __( 'Give Icon', 'give' ),
287-
'heading' => __( 'No donation forms found.', 'give' ),
288-
'message' => __( 'The first step towards accepting online donations is to create a form.', 'give' ),
289-
'cta_text' => __( 'Create Donation Form', 'give' ),
290-
'cta_link' => admin_url( 'post-new.php?post_type=give_forms' ),
288+
'heading' => __('No campaign forms found.', 'give'),
289+
'message' => __('The first step towards accepting online donations is to create a campaign.',
290+
'give'),
291+
'cta_text' => __('Create Campaign Form', 'give'),
292+
'cta_link' => admin_url('edit.php?post_type=give_forms&page=give-campaigns&new=campaign'),
291293
'help' => sprintf(
292294
/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
293295
__( 'Need help? Get started with %1$sGive 101%2$s.', 'give' ),

give.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ final class Give
249249
Give\Settings\ServiceProvider::class,
250250
Give\Campaigns\ServiceProvider::class,
251251
Give\FeatureFlags\OptionBasedFormEditor\ServiceProvider::class,
252+
Give\ThirdPartySupport\ServiceProvider::class,
252253
];
253254

254255
/**

includes/admin/class-blank-slate.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,20 +249,23 @@ private function donor_exists() {
249249
/**
250250
* Gets the content of a blank slate message based on provided context.
251251
*
252-
* @since 1.8.13
252+
* @unreleased Replace "new form" with "new campaign form" link
253+
* @since 1.8.13
253254
*
254255
* @param string $context The key used to determine which content is returned.
256+
*
255257
* @return array Blank slate content.
256258
*/
257259
private function get_content( $context ) {
258260
// Define default content.
259261
$defaults = array(
260262
'image_url' => GIVE_PLUGIN_URL . 'assets/dist/images/give-icon-full-circle.svg',
261-
'image_alt' => __( 'GiveWP Icon', 'give' ),
262-
'heading' => __( 'No donation forms found.', 'give' ),
263-
'message' => __( 'The first step towards accepting online donations is to create a form.', 'give' ),
264-
'cta_text' => __( 'Create Donation Form', 'give' ),
265-
'cta_link' => admin_url( 'post-new.php?post_type=give_forms' ),
263+
'image_alt' => __( 'GiveWP Icon', 'give'),
264+
'heading' => __('No campaign forms found.', 'give'),
265+
'message' => __('The first step towards accepting online donations is to create a campaign.',
266+
'give'),
267+
'cta_text' => __('Create Campaign Form', 'give'),
268+
'cta_link' => admin_url('edit.php?post_type=give_forms&page=give-campaigns&new=campaign'),
266269
'help' => sprintf(
267270
/* translators: 1: Opening anchor tag. 2: Closing anchor tag. */
268271
__( 'Need help? Get started with %1$sGive 101%2$s.', 'give' ),

includes/admin/shortcodes/shortcode-give-form.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,16 @@ public function __construct() {
3333
/**
3434
* Define the shortcode attribute fields
3535
*
36-
* @return array
36+
* @unreleased Replace "new form" with "new campaign form" link
37+
*
38+
* @return array
3739
*/
3840
public function define_fields() {
3941

4042
$create_form_link = sprintf(
4143
/* translators: %s: create new form URL */
42-
__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
43-
admin_url( 'post-new.php?post_type=give_forms' )
44+
__('<a href="%s">Create</a> a new Campaign Form.', 'give'),
45+
admin_url('edit.php?post_type=give_forms&page=give-campaigns&new=campaign')
4446
);
4547

4648
return array(
@@ -51,10 +53,11 @@ public function define_fields() {
5153
),
5254
'name' => 'id',
5355
'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ),
54-
'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
56+
'placeholder' => '- ' . esc_attr__('Select a Campaign Form', 'give') . ' -',
5557
'required' => array(
56-
'alert' => esc_html__( 'You must first select a Form!', 'give' ),
57-
'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
58+
'alert' => esc_html__('You must first select a Campaign Form!', 'give'),
59+
'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>',
60+
esc_html__('No campaign forms found.', 'give'), $create_form_link),
5861
),
5962
),
6063
array(

includes/admin/shortcodes/shortcode-give-goal.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,17 @@ public function __construct() {
3131

3232
/**
3333
* Define the shortcode attribute fields
34+
*
35+
* @unreleased Replace "new form" with "new campaign form" link
3436
*
3537
* @return array
3638
*/
3739
public function define_fields() {
3840

3941
$create_form_link = sprintf(
4042
/* translators: %s: create new form URL */
41-
__( '<a href="%s">Create</a> a new Donation Form.', 'give' ),
42-
admin_url( 'post-new.php?post_type=give_forms' )
43+
__('<a href="%s">Create</a> a new Campaign Form.', 'give'),
44+
admin_url('edit.php?post_type=give_forms&page=give-campaigns&new=campaign')
4345
);
4446

4547
return [
@@ -51,11 +53,12 @@ public function define_fields() {
5153
'meta_value' => 'enabled',
5254
],
5355
'name' => 'id',
54-
'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ),
55-
'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -',
56+
'tooltip' => esc_attr__('Select a Campaign Form', 'give'),
57+
'placeholder' => '- ' . esc_attr__('Select a Campaign Form', 'give') . ' -',
5658
'required' => [
57-
'alert' => esc_html__( 'You must first select a Form!', 'give' ),
58-
'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ),
59+
'alert' => esc_html__('You must first select a Campaign Form!', 'give'),
60+
'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>',
61+
esc_html__('No campaign forms found.', 'give'), $create_form_link),
5962
],
6063
],
6164
[

includes/post-types.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ function give_setup_post_types() {
5656
'name' => __( 'Donation Forms', 'give' ),
5757
'singular_name' => __( 'Form', 'give' ),
5858
'add_new' => __( 'Add Form', 'give' ),
59-
'add_new_item' => __( 'Add New Campaign Form', 'give' ),
60-
'edit_item' => __( 'Edit Campaign Form', 'give' ),
59+
'add_new_item' => __( 'Add New Donation Form', 'give' ),
60+
'edit_item' => __( 'Edit Donation Form', 'give' ),
6161
'new_item' => __( 'New Form', 'give' ),
6262
'all_items' => __( 'All Forms', 'give' ),
6363
'view_item' => __( 'View Form', 'give' ),

0 commit comments

Comments
 (0)