Skip to content

Commit

Permalink
v1.4.0 (#32)
Browse files Browse the repository at this point in the history
* Fix deploy task

* Add npmrc

* Update travis config

* Support banners and youtube in readme, add video

* Use hqdefault for video thumbnail

* GoLF Automated checkin by kchien (2/21/2017 4:30:02 PM)

* Update cssmin package ver

* Fix makepot task

* Update POT

* Update mo

* Bump tested up to 4.8

* Bump tested up to

* Switch wp_nonce to _wpnonce. Fix failing check_admin_referer when action === 'refresh'

* Update devDependencies

* set dist: precise for 5.2

* set dist: precise for 5.2

* Temporarily disable PHP 5.2. See travis-ci/travis-ci#8072

* Update dev dependencies. Re-grunt

* Update changelog with 1.2.1 changes

* Change Text Domain to Match WordPress.org Plugin Slug (#26)

* update text domain for interested translators on translation.wordpress.org to work on plugin strings.

* change text domain to match plugin slug in comments

* fixing according to travis ci warnings

only the i18n warnings.

* more fixes based on travis ci output

* fixing other warnings

* one more warning

* renamed language files to match text domain

https://developer.wordpress.org/plugins/internationalization/how-to-internationalize-your-plugin/#loading-text-domain

* Add GDPR Support (#28)

* Add support for GDPR fields.

* Update gruntfile and npm dependencies

* Add comment for tos_link

* Resolve PHPCS warnings. Update phpcs.ruleset.xml.

* Remove test filter

* Add xmllint addon to travis build config

* Double check for method before calling it. Update checkbox field value to match disply text.

* Update gem-form-fields test to asset invalid_field_type returns empty.

* Readd vendor dir to PHPCS exclusion

* Add test for tos_link

* Add test for tracking_option

* Remove chrome from travis addons

* Remove print

* Add spacing for phpcs warnings

* Add required checkboxes to error checking

* Update update-pot grunt task. Regenerate translations after i18n function updates and updated i18n comments

* Update read for 1.3.0 release

* [dist] update packages

* [dist] New package-lock

* Introduce GEM Gutenberg block (#31)

* Start to build out GEM gutenberg block

* Save block output with proper shortcode

* Add .babelrbs and webpack.config.js to .distignore

* Resolve PHPCS warnings

* Dynamically generate the GEM form in the GEM block

* Bump tested up to version to 5.0

* Fix PHPCS spacing

* Dynamic gem block

* Update dynamic blocks

* Add GEM block screenshots and update readme

* Clean up UX during block addition/form selection. Cleanup JS file.

* Add docblock to class prop

* Update changelog, regenerate readme
  • Loading branch information
Evan Herman committed Dec 13, 2018
1 parent 410420c commit d8a8dee
Show file tree
Hide file tree
Showing 31 changed files with 10,078 additions and 3,960 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [ "@wordpress/default" ]
}
2 changes: 2 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ languages/*.po
node_modules/
tests/
vendor/
.babelrbc
webpack.config.js
16 changes: 13 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module.exports = function( grunt ) {
},

jshint: {
all: [ 'Gruntfile.js', 'js/**/*.js', '!js/**/*.min.js' ]
all: [ 'Gruntfile.js', 'js/**/*.js', '!js/blocks.js', '!js/**/*.min.js' ]
},

makepot: {
Expand Down Expand Up @@ -175,10 +175,16 @@ module.exports = function( grunt ) {
}
},

shell: {
blocks: [
'cross-env BABEL_ENV=default webpack'
].join( ' && ' )
},

watch: {
css: {
files: [ '**/*.css', '!**/*.min.css' ],
tasks: [ 'imagemin' ]
tasks: [ 'cssmin' ]
},
images: {
files: [ 'assets/**/*.{gif,jpeg,jpg,png,svg}', 'images/**/*.{gif,jpeg,jpg,png,svg}' ],
Expand All @@ -191,7 +197,11 @@ module.exports = function( grunt ) {
readme: {
files: 'readme.txt',
tasks: [ 'readme' ]
}
},
blocks: {
files: [ 'includes/blocks/**/*.js', '!includes/blocks/**/*.min.js' ],
tasks: [ 'shell:blocks' ]
},
},

wp_deploy: {
Expand Down
Binary file added assets/screenshot-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshot-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
margin: 10px 20px 0 2px;
}

.about-wrap img {
width: 15px;
}

.intro {
float: left;
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion css/admin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions css/blocks.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.wp-block-godaddy-email-marketing-sign-up-forms-gem-block input:not([type="submit"]) {
width: 100%;
}

.wp-block-godaddy-email-marketing-sign-up-forms-gem-block .preloader {
display: block;
margin: 2em auto;
}
1 change: 1 addition & 0 deletions css/blocks.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions css/gem.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ form.gem-form p.gem-error {
background-image: url( '../images/spinner-2x.gif' );
}
}

/**
* Block Styles
*/
.gem-form-wrapper input:not([type="submit"]) {
width: 100%;
}
2 changes: 1 addition & 1 deletion css/gem.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 25 additions & 8 deletions godaddy-email-marketing.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private function setup_actions() {
add_action( 'init', array( $this, 'init' ) );
add_action( 'widgets_init', array( $this, 'register_widget' ) );
add_action( 'init', array( $this, 'register_shortcode' ), 20 );
add_action( 'init', array( $this, 'load_content_blocks' ) );
add_action( 'admin_notices', array( $this, 'action_admin_notices' ) );

add_filter( 'plugin_action_links_' . self::$basename, array( $this, 'action_links' ), 10 );
Expand Down Expand Up @@ -128,6 +129,9 @@ private function requirements() {
// The shortcode.
require_once GEM_PLUGIN_DIR . 'includes/class-shortcode.php';

// Content blocks.
require_once GEM_PLUGIN_DIR . 'includes/class-blocks.php';

// The file renders the form.
require_once GEM_PLUGIN_DIR . 'includes/render.php';

Expand Down Expand Up @@ -176,6 +180,15 @@ public function register_shortcode() {
add_action( 'register_shortcode_ui', array( $shortcode, 'shortcode_ui' ) );
}

/**
* Load content blocks.
*/
public function load_content_blocks() {

new GEM_Blocks();

}

/**
* Registers the widget.
*/
Expand All @@ -197,14 +210,18 @@ public function enqueue() {
wp_enqueue_style( 'gem-base', plugins_url( "css/gem{$suffix}.css", __FILE__ ), false, GEM_VERSION );

// Help strings.
wp_localize_script( 'gem-main', 'GEM', array(
'thankyou' => __( 'Thank you for signing up!', 'godaddy-email-marketing-sign-up-forms' ),
'thankyou_suppressed' => __( 'Thank you for signing up! Please check your email to confirm your subscription.', 'godaddy-email-marketing-sign-up-forms' ),
'oops' => __( 'Oops! There was a problem. Please try again.', 'godaddy-email-marketing-sign-up-forms' ),
'email' => __( 'Please enter a valid email address.', 'godaddy-email-marketing-sign-up-forms' ),
/* translators: %s: Name of required field */
'required' => __( '%s is a required field.', 'godaddy-email-marketing-sign-up-forms' ),
) );
wp_localize_script(
'gem-main',
'GEM',
array(
'thankyou' => __( 'Thank you for signing up!', 'godaddy-email-marketing-sign-up-forms' ),
'thankyou_suppressed' => __( 'Thank you for signing up! Please check your email to confirm your subscription.', 'godaddy-email-marketing-sign-up-forms' ),
'oops' => __( 'Oops! There was a problem. Please try again.', 'godaddy-email-marketing-sign-up-forms' ),
'email' => __( 'Please enter a valid email address.', 'godaddy-email-marketing-sign-up-forms' ),
/* translators: %s: Name of required field */
'required' => __( '%s is a required field.', 'godaddy-email-marketing-sign-up-forms' ),
)
);
}

/**
Expand Down
138 changes: 138 additions & 0 deletions includes/blocks/blocks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
// Locale
import './i18n.js';
import gemIcons from './icons';

/**
* Internal block libraries
*/
const { __ } = wp.i18n;

const {
registerBlockType
} = wp.blocks;

const {
SelectControl
} = wp.components;

/**
* Register block
*/
export default registerBlockType( 'godaddy-email-marketing-sign-up-forms/gem-block', {
title: __( 'GoDaddy Email Marketing', 'godaddy-email-marketing-sign-up-forms' ),
description: __( 'Display a GoDaddy email marketing form.', 'godaddy-email-marketing-sign-up-forms' ),
category: 'widgets',
icon: gemIcons.mail,
keywords: [
__( 'GoDaddy', 'godaddy-email-marketing-sign-up-forms' ),
__( 'Email', 'godaddy-email-marketing-sign-up-forms' ),
__( 'Form', 'godaddy-email-marketing-sign-up-forms' ),
],

attributes: {
form: {
type: 'string',
sourece: 'text',
default: gem.isConnected ? gem.forms[0].value : undefined,
},
},

edit: props => {

const { attributes: { form }, isSelected, className, setAttributes } = props;

return [

// Admin Block Markup
<div className={ className } key={ className }>
<div className="gem-forms">
{ isSelected ? (
getFormSelect( form, setAttributes )
) : ( <div className="gem-form"><img src={ gem.preloaderUrl } className="preloader" />{ renderGemForm( form ) }</div> ) }
</div>
</div>

];
},

save: props => {
const { attributes: { form }, className } = props;

if ( ! gem.isConnected ) {

return;

}

return ( '[gem id=' + form + ']' );
},
} );

/**
* Generate the GoDaddy Email Marketing form select field.
*
* @param {integer} form Form ID
* @param {function} setAttributes Set attributes method.
*/
function getFormSelect( form, setAttributes ) {

if ( ! gem.isConnected ) {

return notConnectedError();

}

return <SelectControl
className="form"
label={ __( 'Gem Form', 'godaddy-email-marketing-sign-up-forms' ) }
value={ form }
options={ gem.forms }
onChange={ ( form ) => { setAttributes( { form } ) } }
/>

}

/**
* Render the GoDaddy Email Marketing form markup
*
* @param {integer} formID Form ID
*/
function renderGemForm( formID ) {

if ( ! gem.isConnected ) {

return notConnectedError();

}

var data = {
'action': 'get_gem_form',
'formID': formID,
};

$.post( ajaxurl, data, function( response ) {

if ( ! response.success ) {

$( '.gem-form' ).html( gem.getFormError );

return;

}

$( '.gem-form' ).html( response.data );

} );

}

/**
* Render the error message when not connected to the GoDaddy Email Marketing API
*
* @return {mixed} Markup for the Not connected error notice.
*/
function notConnectedError() {

return <div>{ __( 'GoDaddy Email Marketing is not connected.', 'godaddy-email-marketing-sign-up-forms' ) } <p><a class="button button-secondary" href={ gem.settingsURL }> {__( 'Connect Now', 'godaddy-email-marketing-sign-up-forms' ) }</a></p></div>;

}
4 changes: 4 additions & 0 deletions includes/blocks/i18n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/*
* Set Locale
*/
wp.i18n.setLocaleData( { '': {} }, 'godaddy-email-marketing-sign-up-forms' );
17 changes: 17 additions & 0 deletions includes/blocks/icons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const gemIcons = {};

gemIcons.mail = <svg
xmlns="http://www.w3.org/2000/svg"
width="20pt"
height="22pt"
viewBox="0 0 20 22"
version="1.1"
>
<g id="surface1">
<path style={{ stroke: 'none', fillRule: 'nonzero', fill: 'rgb(23.137255%,76.078431%,18.039216%)', fillOpacity: '1' }} d="M 0.0390625, 11.097656 L 1.925781, 22 L 19.960938, 18.109375, L 19.960938, 6.890625, L 11.371094, 15.828125, Z M 0.0390625, 11.097656 "/>
<path style={{ stroke: 'none', fillRule: 'nonzero', fill: 'rgb(23.137255%,76.078431%,18.039216%)', fillOpacity: '1' }} d="M 9.882812, 6.632812 C 6.785156, 7.230469, 0.164062, 9.597656, 0.164062, 9.597656, L 11.171875, 14.9375, L 19.289062, 5.828125, C 19.289062, 5.816406, 13.042969, 6.011719, 9.882812, 6.632812, Z M 9.882812, 6.632812 "/>
<path style={{ stroke: 'none', fillRule: 'nonzero', fill: 'rgb(23.137255%,66.27451%,16.470588%)', fillOpacity: '1' }} d="M 0.164062, 9.597656 C 0.164062, 9.597656, 6.472656, 8.304688, 9.484375, 7.71875, L 19.277344, 5.816406, L 8.628906, 0 Z M 0.164062, 9.597656 "/>
</g>
</svg>;

export default gemIcons;
Loading

0 comments on commit d8a8dee

Please sign in to comment.