Skip to content

Commit

Permalink
Merge branch 'develop' into feature/fields-api-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloiankoski committed Jul 22, 2023
2 parents 59ef214 + 159bdfd commit b69a6a7
Show file tree
Hide file tree
Showing 32 changed files with 673 additions and 191 deletions.
201 changes: 201 additions & 0 deletions assets/src/css/admin/summer-sales-banner.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
.give-sale-banners-container {
/* Box-sizing reset */
&,
& *,
& ::before,
& ::after {
box-sizing: border-box;
}

overflow: hidden;
}

.give-sale-banner {
position: relative;
display: flex;
justify-content: space-between;
background: #1D202F;
min-height: 180px;
--banner-y-pad: 0.6875em;
padding-top: var(--banner-y-pad);
padding-bottom: var(--banner-y-pad);
padding-left: 3.25em;
padding-right: 1.3125em;
box-shadow: 0 0.0625em 0.25em rgba(0, 0, 0, 0.25);
font-size: clamp(max(0.875rem, 14px), 2vw, max(1rem, 16px));
color: #F9FAF9;
}

.give-sale-banner-content {
display: flex;
align-items: center;
justify-content: center;
gap: 3rem;
width: 70%;

& * {
font-size: inherit;
font-family: 'Neurial Grotesk', Montserrat, sans-serif;
}

a {
color: inherit;
font-weight: 700;
text-decoration-thickness: 0.05em;
transform-style: preserve-3d;
font-size: 0.875rem;

&::after {
content: "";
position: absolute;
transform: translateZ(-1px);
display: block;
background-color: #fff;
height: calc(100% + 0.2em);
width: calc(100% + 0.6em);
top: -0.1em;
left: -0.3em;
opacity: 0;
box-shadow: 0 0.0625em 0.125em rgba(0, 0, 0, 0.05);
transition: opacity 0.2s ease-in-out;
}

&:focus {
outline: none;
box-shadow: none;
}
}

&__primary-cta {
width: fit-content;

> h1 {
font-size: 1.5rem;
font-style: normal;
font-weight: 700;
line-height: normal;
color: #F9FAF9;
}

> p {
font-size: 1.375rem;
font-style: normal;
font-weight: 400;
line-height: normal;
}


&-link {
font-family: 'Inconsolata', Montserrat, sans-serif;;
margin-top: 1.125rem;
display: inline-flex;
padding: 0.73125rem 1.6714375rem;
justify-content: center;
align-items: center;
background: #62B265;
border-radius: 9999px;
text-decoration: none;
margin-right: auto;
}

&-mobile-link {
display: none;
margin: 1rem 0 0 1rem;
color: #fff;
background: none;
}
}

&__secondary-cta {
flex: 1;
display: flex;
flex-direction: column;
gap: 1.125rem;
}

& p {
display: flex;
flex-wrap: wrap;
row-gap: 0.25rem;
column-gap: 0.9375em;
margin: 0;
line-height: 1.37;
}
}

.give-sale-banner__abstract-icon {
position: absolute;
bottom: 0;
right: 0;
}


.give-sale-banner-dismiss {
--size: 1.25rem;
/* Artificially align this with the sale icon, since we shouldn’t use align-items: center on the banner */
//margin-top: calc((var(--sale-icon-size) - var(--size)) / 2);
appearance: none;
background: none;
display: grid;
place-content: center;
padding: 0;
width: var(--size);
height: var(--size);
border: 0;
outline-offset: 0.25rem;
color: inherit;
cursor: pointer;
font-size: inherit;
transition: color 0.2s, transform 0.2s;
z-index: 999;

& svg {
width: var(--size);
height: var(--size);
transition: fill 200ms ease-in-out;
fill: none;

/* This ensures that the event target is the button when clicked. */
pointer-events: none;
}

&:hover {
transform: scale(1.15);
}

&:active {
transform: scale(0.95);
}
}

@media screen and (max-width: 1100px) {
.give-sale-banner-content {
flex-direction: column;
align-items: flex-start;
}
}

@media screen and (max-width: 770px) {
.give-sale-banner {
padding-left: 1rem;
}

.give-sale-banner-content__secondary-cta {
display: none;
}

.give-sale-banner-content__primary-cta-mobile-link {
display: inline-block;
}

.give-sale-banner__abstract-icon {
max-width: 8.25rem;
max-height: 9.5rem;
}
}

@media screen and (max-width: 480px) {
.give-sale-banner-content__primary-cta-mobile-link {
margin-left: 0;
}
}
5 changes: 5 additions & 0 deletions blocks/donation-form/edit/block.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
form[id*='give-form'] #give-gateway-radio-list > li input[type='radio'] {
display: inline-block;
}

iframe {
pointer-events: none;
width: 100% !important;
}
}

.give-change-donation-form-btn {
Expand Down
53 changes: 27 additions & 26 deletions blocks/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n'
import {__} from '@wordpress/i18n';

/**
* getSiteUrl from API root
* @returns {string} siteurl
*/
export function getSiteUrl() {
return wpApiSettings.root.replace( '/wp-json/', '' );
return wpApiSettings.root.replace('/wp-json/', '');
}

/**
Expand All @@ -20,44 +20,45 @@ export function getSiteUrl() {
*
* @return {[]}
*/
export function getFormOptions( forms ) {
let formOptions = [];

if ( forms ) {
formOptions = forms.map(
( { id, title: { rendered: title } } ) => {
return {
value: id,
label: title === '' ? `${ id } : ${ __( 'No form title', 'give' ) }` : title,
};
}
);
}

// Add Default option
formOptions.unshift( { value: '0', label: __( '-- Select Form --', 'give' ) } );

return formOptions;
export function getFormOptions(forms) {
let formOptions = [];

if (forms) {
formOptions = forms.map(({id, title: {rendered: title}}) => {
return {
value: id,
label: title === '' ? `${id} : ${__('No form title', 'give')}` : title,
};
});
}

// Add Default option
formOptions.unshift({value: '0', label: __('-- Select Form --', 'give')});

return formOptions;
}

/**
* Returns whether or not the given form uses the legacy form template.
*
* Note: if selected form has legacy form template or empty (old forms) then it will return true otherwise false.
*
* @since 2.30.0 Filter v3 forms out of the form list.
* @since 2.7.0
*
* @param {object} forms
* @param {number} SelectedFormId
*
* @return {boolean}
*/
export function isLegacyForm( forms, SelectedFormId ) {
if ( forms ) {
const data = forms.find( form => parseInt( form.id ) === parseInt( SelectedFormId ) );
export function isLegacyForm(forms, SelectedFormId) {
if (forms) {
const data = forms.find((form) => parseInt(form.id) === parseInt(SelectedFormId));

return data && ( ! data.formTemplate || data.formTemplate === 'legacy' );
}
return (
data && data.excerpt.rendered !== '<p>[]</p>\n' && (!data.formTemplate || data.formTemplate === 'legacy')
);
}

return false;
return false;
}
4 changes: 2 additions & 2 deletions give.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Description: The most robust, flexible, and intuitive way to accept donations on WordPress.
* Author: GiveWP
* Author URI: https://givewp.com/
* Version: 2.29.2
* Version: 2.31.0
* Requires at least: 5.0
* Requires PHP: 7.0
* Text Domain: give
Expand Down Expand Up @@ -316,7 +316,7 @@ private function setup_constants()
{
// Plugin version.
if (!defined('GIVE_VERSION')) {
define('GIVE_VERSION', '2.29.2');
define('GIVE_VERSION', '2.31.0');
}

// Plugin Root File.
Expand Down
2 changes: 1 addition & 1 deletion includes/ajax-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function give_load_checkout_fields() {
/**
* Retrieve a states drop down
*
* @unreleased add 'state_label' & 'states' to response
* @since 2.30.0 add 'state_label' & 'states' to response
* @since 1.0
*
* @return void
Expand Down
2 changes: 1 addition & 1 deletion includes/donors/class-give-donor-wall.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function render_shortcode( $atts ) {
/**
* Parse shortcode attributes
*
* @unreleased
* @since 2.30.0
* @since 2.2.0
* @access public
*
Expand Down
2 changes: 1 addition & 1 deletion includes/gateways/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Returns a list of all available gateways.
*
* @unreleased add filter give_payment_gateways_admin_label
* @since 2.30.0 add filter give_payment_gateways_admin_label
* @since 1.0
* @return array $gateways All the available gateways
*/
Expand Down
12 changes: 10 additions & 2 deletions includes/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ function give_donation_history( $atts, $content = false ) {
*
* Show the Give donation form.
*
* @since 2.30.0 Add short-circuit filter to allow for custom output.
* @since 1.0
*
* @param array $atts Shortcode attributes
* @param array $atts Shortcode attributes
*
* @return string
*/
Expand All @@ -148,6 +149,13 @@ function give_form_shortcode( $atts ) {
$atts['id'] = $atts['id'] ?: FrontendFormTemplateUtils::getFormId();
$formId = absint( $atts['id'] );

// Short-circuit the shortcode output if the filter returns a non-empty string.
$output = apply_filters('givewp_form_shortcode_output', '', $atts);

if ($output) {
return $output;
}

// Fetch the Give Form.
ob_start();

Expand Down
13 changes: 12 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: donation, donate, recurring donations, fundraising, crowdfunding
Requires at least: 5.0
Tested up to: 6.2
Requires PHP: 7.0
Stable tag: 2.29.2
Stable tag: 2.31.0
License: GPLv3
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -258,6 +258,17 @@ The 2% fee on Stripe donations only applies to donations taken via our free Stri
8. GiveWP has a dedicated support team to help answer any questions you may have and help you through stumbling blocks.

== Changelog ==
= 2.31.0: July 21st, 2023 =
* Feature: New banner added to the plugin page for annual summer discounts

= 2.30.0: July 12th, 2023 =
* Feature: Attributes of the [give_donor_wall] shortcode can now be filtered.
* Feature: Added state label and list of states for the v3 form billing address block. Existing functionality is not modified.
* Fix: Empty excerpt fields for v3 forms no longer display as [] on the Form Grid.
* Refactor: Updated the gateway adapter for v3 forms.
* Refactor: Updated legacy donation form block title with a (v2) suffix.
* Refactor: The v2 Donation Form block now supports v3 forms.

= 2.29.2: June 29th, 2023 =
* Enhancement: PayPal Donations now has separate buttons to connect to PayPal Live and PayPal Sandbox.
* Fix: Form Field Manager conditional radio and checkbox fields that are not visible no longer prevent donation submission.
Expand Down
Loading

0 comments on commit b69a6a7

Please sign in to comment.