Skip to content

Commit

Permalink
Merge branch 'develop' into 'master'
Browse files Browse the repository at this point in the history
release 1.2.1

See merge request products/gravity-integrations/field-helper-for-gravity-forms!52
  • Loading branch information
andrewminion-luminfire committed Sep 28, 2020
2 parents dc853e9 + 6c13abf commit 25491ca
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 64 deletions.
1 change: 0 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Build Plugin Package:
name: "$PLUGIN_SLUG.$CI_COMMIT_TAG"
paths:
- $PLUGIN_SLUG.$CI_COMMIT_TAG.zip
when: manual

Deploy Documentation:
stage: deploy
Expand Down
5 changes: 5 additions & 0 deletions assets/css/gravity-forms-field-helper.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
input[pattern]:invalid{
color: red;
outline: 1px solid red;
border: 1px solid red;
}
19 changes: 19 additions & 0 deletions assets/js/gravity-forms-field-helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use strict';
(function($) {
$(document).ready(function() {

/**
* Disable submit/next buttons for invalid input patterns.
*
* @since 1.2.1
*/
$('body').on('change', 'form[id^="gform_"] input[pattern]', function() {
if ($(this).is(':invalid')) {
$('.gform_button, .gform_next_button').attr('disabled', true);
} else {
$('.gform_button, .gform_next_button').attr('disabled', false);
}
});

});
}(jQuery));
2 changes: 0 additions & 2 deletions bin/gitlab-ci-lint.sh

This file was deleted.

14 changes: 0 additions & 14 deletions bin/php-getFilesChanged.sh

This file was deleted.

20 changes: 0 additions & 20 deletions bin/php-syntaxChecker-changed.sh

This file was deleted.

22 changes: 0 additions & 22 deletions bin/php-syntaxChecker-full.sh

This file was deleted.

1 change: 0 additions & 1 deletion bin/php-syntaxChecker-skipFiles

This file was deleted.

13 changes: 13 additions & 0 deletions class-gf-input-pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,24 @@ public function __construct() {

// Frontend.
add_filter( 'gform_field_content', array( $this, 'add_input_pattern' ), 15, 5 );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_assets' ) );

// Validation.
add_filter( 'gform_field_validation', array( $this, 'validate_input_pattern' ), 10, 4 );
}

/**
* Enqueue frontend styles.
*
* @since 1.2.1
*
* @return void
*/
public function enqueue_assets() {
wp_enqueue_style( 'gravity-forms-field-helper' );
wp_enqueue_script( 'gravity-forms-field-helper' );
}

/**
* Render plugin page content.
*
Expand Down
7 changes: 7 additions & 0 deletions documentation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

# 1.2.1 | 2020-09-28

## Features

- Highlight fields with invalid input patterns.
- Disable form submission when a field has an invalid input pattern.

# 1.2.0 | 2020-09-28

## Features
Expand Down
24 changes: 20 additions & 4 deletions field-helper-for-gravity-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Field Helper for Gravity Forms
* Plugin URI: https://brilliantplugins.com/
* Description: Enables Gravity Forms users to set consistent, human-friendly field names for use in the Gravity Forms REST API.
* Version: 1.2.0
* Version: 1.2.1
* Author: BrilliantPlugins
* Author URI: https://brilliantplugins.com
* License: GPL-2.0+
Expand All @@ -30,7 +30,7 @@
* @package gravity-forms-field-helper
*/

define( 'GF_FIELD_HELPER_VERSION', '1.2.0' );
define( 'GF_FIELD_HELPER_VERSION', '1.2.1' );
define( 'GF_FIELD_HELPER_FILE', __FILE__ );
define( 'GF_FIELD_HELPER_SLUG', 'gravity-forms-field-helper' );

Expand Down Expand Up @@ -74,7 +74,10 @@ public static function load_field_helper() {
GFAddOn::register( 'GF_Input_Pattern' );

// Backend assets.
add_action( 'admin_enqueue_scripts', 'GF_Field_Helper_Bootstrap::enqueue_assets' );
add_action( 'admin_enqueue_scripts', 'GF_Field_Helper_Bootstrap::register_backend_assets' );

// Frontend assets.
add_action( 'wp_enqueue_scripts', 'GF_Field_Helper_Bootstrap::register_frontend_assets' );
}

/**
Expand All @@ -84,10 +87,23 @@ public static function load_field_helper() {
*
* @return void
*/
public static function enqueue_assets() {
public static function register_backend_assets() {
wp_register_script( 'gravity-forms-field-helper-admin', plugin_dir_url( GF_FIELD_HELPER_FILE ) . '/assets/js/gravity-forms-field-helper-admin.js', array( 'jquery' ), GF_FIELD_HELPER_VERSION, true );
}

/**
* Register/enqueue frontend assets.
*
* @since 1.2.1
*
* @return void
*/
public static function register_frontend_assets() {
wp_register_script( 'gravity-forms-field-helper', plugin_dir_url( GF_FIELD_HELPER_FILE ) . '/assets/js/gravity-forms-field-helper.js', array( 'jquery' ), GF_FIELD_HELPER_VERSION, true );

wp_register_style( 'gravity-forms-field-helper', plugin_dir_url( GF_FIELD_HELPER_FILE ) . '/assets/css/gravity-forms-field-helper.css', array(), GF_FIELD_HELPER_VERSION );
}

/**
* Register custom REST API endpoint.
*
Expand Down

0 comments on commit 25491ca

Please sign in to comment.