Skip to content

Commit

Permalink
Merge branch 'release/4.0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Mar 19, 2020
2 parents cf42879 + 1c77880 commit 6e80054
Show file tree
Hide file tree
Showing 14 changed files with 2,704 additions and 1,469 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# v4.0.6
## 03/19/2020
1. [](#new)
* CHANGE: Form labels are now displayed in `raw` format so you can use HTML in them
* Added support for `name` attribute on buttons [#411](https://github.com/getgrav/grav-plugin-form/issues/411)
1. [](#improved)
* Added support for `classes` option in `avatar` field
* Recompiled JS with latest NPM libraries
1. [](#bugfix)
* Fixed password field outputting the contents to HTML (will now always be empty when loading the page)
* Escape default output in `formdata.html.twig` [#384](https://github.com/getgrav/grav-plugin-form/issues
* Better JS rendering of captcha field scripts for VueJS template compatibility

# v4.0.5
## 03/05/2020

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,12 @@ The Learn site has two pages describing how to use the Form Plugin:

# Using email

Note: when using email functionality in your forms, make sure you have configured the Email plugin correctly. In particular, make sure you configured the "Email from" and "Email to" email addresses in the Email plugin with your email address
Note: when using email functionality in your forms, make sure you have configured the Email plugin correctly. In particular, make sure you configured the "Email from" and "Email to" email addresses in the Email plugin with your email address.

# NOTES:

As of version **Form version 4.0.6**, form labels are now being output with the `|raw` filter. If you wish to show HTML in your form label, ie `Root Folder <root>`, then you need to escape that in your form definition:

```yaml
label: Root Folder &lt;root&gt;
```
10 changes: 5 additions & 5 deletions assets/form.min.js

Large diffs are not rendered by default.

24 changes: 10 additions & 14 deletions assets/form.vendor.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Form
version: 4.0.5
version: 4.0.6
testing: false
description: Enables the forms handling
icon: check-square
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
"eslint": "^5.6.0",
"eslint-loader": "^2.1.1",
"exports-loader": "^0.7.0",
"gulp": "latest",
"gulp-autoprefixer": "latest",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^7.0.1",
"gulp-clean-css": "^3.10.0",
"gulp-csscomb": "^3.0.8",
"gulp-rename": "^1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/default/data.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{% elseif field.type == 'select' %}
{{ field.options[form.value(scope ~ field.name)]|e }}
{% else %}
{{ string(form.value(scope ~ field.name))|nl2br }}
{{ string(form.value(scope ~ field.name))|e|nl2br }}
{% endif %}
{% endblock %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/default/field.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

{# Field Label #}
{% set form_field_label = field.markdown ? field.label|markdown(false) : field.label %}
{% set form_field_label = form_field_label|default(field.name|capitalize)|t|e %}
{% set form_field_label = form_field_label|default(field.name|capitalize)|t %}

{# Field Help #}
{% if field.help %}
Expand Down
6 changes: 5 additions & 1 deletion templates/forms/default/form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@
{% block embed_button_core %}
{% if button.id %}id="{{ button.id }}"{% endif %}
{% if button.disabled %}disabled="disabled"{% endif %}
{% if button.task %}name="task" value="{{ button.task }}"{% endif %}
{% if button.name %}
name="{{ button.name }}"
{% else %}
{% if button.task %}name="task" value="{{ button.task }}"{% endif %}
{% endif %}
type="{{ button.type|default('submit') }}"
{% endblock %}

Expand Down
6 changes: 3 additions & 3 deletions templates/forms/fields/avatar/avatar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{% block field %}
{% set avatar = form.value('avatar') %}
{% if avatar %}
<label><img style="max-width:200px;" src="{{ base_url_simple ~ '/' ~ (avatar|first).path }}" /></label>
<label class="{{ field.classes }}"><img class="{{ field.img_classes }}" style="max-width:200px;" src="{{ base_url_simple ~ '/' ~ (avatar|first).path }}" /></label>
{% else %}
<label><img src="https://www.gravatar.com/avatar/{{ form.value('email')|md5 }}?s=200" /></label>
<label class="{{ field.classes }}"><img class="{{ field.img_classes }}" src="https://www.gravatar.com/avatar/{{ form.value('email')|md5 }}?s=200" /></label>
{% endif %}
{% endblock %}
{% endblock %}
12 changes: 6 additions & 6 deletions templates/forms/fields/captcha/captcha.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

{% block input %}
{% if not site_key %}
<script>console && console.error('site_key was not defined for form "{{ form.name }}" (Grav Form Plugin)')</script>
<script type="application/javascript">console && console.error('site_key was not defined for form "{{ form.name }}" (Grav Form Plugin)')</script>
{% elseif config.plugins.form.recaptcha.version == 3 %}
{#{% do assets.addJs('https://www.google.com/recaptcha/api.js?render='~site_key) %}#}
<script src='https://www.google.com/recaptcha/api.js?render={{ site_key }}&theme={{ theme }}'></script>
<script>
{% do assets.addJs('https://www.google.com/recaptcha/api.js?render='~site_key~'&theme=' ~ theme) %}
{#<script src='https://www.google.com/recaptcha/api.js?render={{ site_key }}&theme={{ theme }}'></script>#}
<script type="application/javascript">
(document.querySelectorAll('form') || []).forEach(function(form, index) {
var submit = function(event) {
event.preventDefault();
Expand Down Expand Up @@ -42,7 +42,7 @@
});
</script>
{% elseif config.plugins.form.recaptcha.version == '2-invisible' %}
<script>
<script type="application/javascript">
function captchaOnloadCallback_{{ formName }}() {
var form = document.querySelector('form#{{ form.id }}');
var submits = form.querySelectorAll('[type="submit"]') || [];
Expand Down Expand Up @@ -75,7 +75,7 @@
<script src="https://www.google.com/recaptcha/api.js?onload=captchaOnloadCallback_{{ formName }}&hl={{ grav.language.language }}&theme={{ theme }}"
async defer></script>
{% else %}
<script>
<script type="application/javascript">
var captchaOnloadCallback_{{ formName }} = function captchaOnloadCallback_{{ formName }}() {
grecaptcha.render('g-recaptcha-{{ formName }}', {
'sitekey': "{{ site_key }}",
Expand Down
2 changes: 2 additions & 0 deletions templates/forms/fields/password/password.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends "forms/field.html.twig" %}

{% set value = null %}

{% block input_attributes %}
type="password"
{{ parent() }}
Expand Down
4 changes: 2 additions & 2 deletions templates/forms/layouts/field.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<label class="{{ layout_form_field_label_classes }}{{ form_field_label_trim }}" {% if field.id %}for="{{ form_field_for }}"{% endif %}>
{%- block label -%}
{%- if form_field_help -%}
<span class="tooltip" data-tooltip="{{ form_field_help|e }}">{{ form_field_label }}</span>
<span class="tooltip" data-tooltip="{{ form_field_help|e }}">{{ form_field_label|raw }}</span>
{%- else -%}
{{ form_field_label }}
{{ form_field_label|raw }}
{%- endif -%}
{%- if form_field_required %}
<span class="required">*</span>
Expand Down
Loading

0 comments on commit 6e80054

Please sign in to comment.