Skip to content

Commit

Permalink
Merge pull request #34 from aradianoff/scroll-anchor-fixes
Browse files Browse the repository at this point in the history
Scroll anchor fixes
  • Loading branch information
JesseMaxwell committed Jan 7, 2017
2 parents c5bf1c9 + 78ddd9b commit f2708d9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# v2.1.0
## 1/7/2017

1. [](#new)
* Added option to have a data-callback for the Google Recaptcha

[](#improved)
* Added scroll anchor so the page scrolls to the message when there is one.

# v2.0.1
## 10/11/2016

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: reCAPTCHA Contact
version: 2.0.2
version: 2.1.0
description: "This plugin adds contact form features for sending email with google reCAPTCHA 2.0 validation."
icon: paper-plane-o
author:
Expand Down
6 changes: 3 additions & 3 deletions recaptchacontact.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?php
/**
* reCAPTCHA Contact v2.0.2
* reCAPTCHA Contact v2.1.0
*
* This plugin adds contact form features for sending email with
* google reCAPTCHA 2.0 validation.
*
* Licensed under the MIT license, see LICENSE.
*
* @package recaptchacontact
* @version 2.0.1
* @version 2.1.0
* @link <https://github.com/aradianoff/recaptchacontact>
* @author aRadianOff - Inés Naya <inesnaya@aradianoff.com>
* @copyright 2015, Inés Naya - aRadianOff
* @copyright 2017, Inés Naya - aRadianOff
* @license <http://opensource.org/licenses/MIT> MIT
*/

Expand Down
1 change: 1 addition & 0 deletions recaptchacontact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ disable_css: false
inject_template: true # if false, include the partials/recaptchaform or partials/container template manually
grecaptcha_sitekey: "your reCAPTCHA site key" # override in your /user/config/plugins/recaptchacontact.yaml
grecaptcha_secret: "your secret-g-recaptcha-key" # override in your /user/config/plugins/recaptchacontact.yaml and keep it in a non-public repository
grecaptcha_callback: false # advanced usage only. @see https://developers.google.com/recaptcha/docs/verify
4 changes: 4 additions & 0 deletions templates/partials/recaptcha_js.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<script type="text/javascript">
location.href = "#";
location.href = "#contact-form";
</script>
13 changes: 8 additions & 5 deletions templates/partials/recaptchaform.html.twig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{% if page.modular == true %}
{% set target_slug = page.parent.slug %}
{% set target_slug = page.parent.slug %}
{% else %}
{% set target_slug = page.slug %}
{% endif %}

<div> {# Twig or Parsedown will render this template as raw HTML without this DIV. #}
<div class="recaptcha-form-container" id="contact-form"> {# Twig or Parsedown will render this template as raw HTML without this DIV. #}
{% if recaptchacontact.message %}
{% include 'partials/recaptcha_message.html.twig' with { 'message': recaptchacontact.message } %}
{% endif %}
Expand All @@ -25,14 +25,14 @@
<div class="recaptcha-form-group form-group">
<label class="recaptcha-label control-label" for="email">{{ recaptchacontact.fields.email.label ?:'RECAPTCHACONTACT.FIELDS.EMAIL.LABEL'|t }}</label>
<input id="email" name="email" type="text" placeholder="{{ recaptchacontact.fields.email.placeholder ?:'RECAPTCHACONTACT.FIELDS.EMAIL.PLACEHOLDER'|t }}" class="recaptcha-field form-control" value="{{ recaptchacontact.session.email }}"/>
</div>
</div>

<div class="recaptcha-form-group form-group">
<label class="recaptcha-label control-label" for="message">{{ recaptchacontact.fields.message.label ?:'RECAPTCHACONTACT.FIELDS.MESSAGE.LABEL'|t }}</label>
<textarea class="recaptcha-textarea form-control" id="message" name="message" placeholder="{{ recaptchacontact.fields.message.placeholder ?:'RECAPTCHACONTACT.FIELDS.MESSAGE.PLACEHOLDER'|t }}" rows="5">{{ recaptchacontact.session.message }}</textarea>
</div>

<div class="g-recaptcha" data-sitekey={{ recaptchacontact.grecaptcha_sitekey }}></div>
<div class="g-recaptcha" data-sitekey={{ recaptchacontact.grecaptcha_sitekey }}{% if recaptchacontact.grecaptcha_callback %} data-callback="{{ recaptchacontact.grecaptcha_callback }}"{% endif %}></div>

<div class="recaptcha-hidden form-group antispam-div">
<label class="control-label" for="antispam">{{ 'RECAPTCHACONTACT.FIELDS.ANTISPAM.LABEL'|t }}</label>
Expand All @@ -46,5 +46,8 @@
</div>
</fieldset>
</form>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl={{ grav.language.getActive ?: recaptchacontact.default_lang }}" async></script>
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl={{ grav.language.getActive ?: recaptchacontact.default_lang }}" defer></script>
{% if recaptchacontact.message %}
{% include 'partials/recaptcha_js.html.twig' %}
{% endif %}
</div>

0 comments on commit f2708d9

Please sign in to comment.