Skip to content

Commit

Permalink
Merge branch 'release/4.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Jan 2, 2020
2 parents 5590b93 + cfd5301 commit e090e82
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 14 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# v4.0.1
## 01/02/2020

1. [](#improved)
* Improve Grav 1.7 support by not using deprecated `$page->modular()` call
* Use form scope if it is defined
1. [](#bugfix)
* Fixed bad HTML in select, radio, key, toggle, checkbox ad textarea when using tabindex attribute
* Fixed bad looking `tabs` field with a single tab in admin

# v4.0.0
## 10/06/2019
## 11/06/2019

1. [](#new)
* Added `tabindex` to global attributes of default field
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: Form
version: 4.0.0
version: 4.0.1
testing: false
description: Enables the forms handling
icon: check-square
Expand Down
2 changes: 1 addition & 1 deletion classes/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function __construct(PageInterface $page, $name = null, $form = null)
}

// If we're on a modular page, find the real page.
while ($page && $page->modular()) {
while ($page && $page->modularTwig()) {
$header = $page->header();
$header->never_cache_twig = true;
$page = $page->parent();
Expand Down
2 changes: 1 addition & 1 deletion form.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function onPageProcessed(Event $e)

// Force never_cache_twig if modular form (recursively up)
$current = $page;
while ($current && $current->modular()) {
while ($current && $current->modularTwig()) {
$header = $current->header();
$header->never_cache_twig = true;

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 @@ -124,7 +124,7 @@
{% if field.autocomplete is defined %}autocomplete="{{ field.autocomplete }}"{% endif %}
{% if field.autocapitalize in ['off', 'characters', 'words', 'sentences'] %}autocapitalize="{{ field.autocapitalize }}"{% endif %}
{% if field.inputmode in ['none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url'] %}inputmode="{{ field.inputmode }}"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}" %}{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% if field.spellcheck in ['true', 'false'] %}spellcheck="{{ field.spellcheck }}"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.validate.pattern %}pattern="{{ field.validate.pattern|e }}"{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/default/form.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{% include 'partials/form-messages.html.twig' %}

{% set scope = scope ?: 'data.' %}
{% set scope = scope ?: form.scope is defined ? form.scope : 'data.' %}
{% set multipart = '' %}
{% set blueprints = blueprints ?? form.blueprint() %}
{% set method = form.method|upper|default('POST') %}
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/fields/checkbox/checkbox.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}" %}{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% endblock %}
/>
<label style="display:inline;" class="inline" for="{{ id|e }}">
Expand Down
4 changes: 2 additions & 2 deletions templates/forms/fields/key/key.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
{% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}" %}{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
{% if field.validate.pattern %}pattern="{{ field.validate.pattern }}"{% endif %}
{% if field.validate.message %}title="{{ field.validate.message|e|t }}"
{% elseif field.title is defined %}title="{{ field.title|e|t }}" {% endif %}
{% endblock %}
/>
</div>
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion templates/forms/fields/radio/radio.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{% if key == value %}checked="checked" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}" %}{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
/>
<label style="display: inline" class="inline" for="{{ id|e }}">{{ text|t|raw }}</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/fields/select/select.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% if required %}required="required"{% endif %}
{% if field.multiple in ['on', 'true', 1] %}multiple="multiple"{% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}" %}{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% if field.form %}form="{{ field.form }}"{% endif %}
{% if field.key %}
data-key-observe="{{ (scope ~ field.name)|fieldName }}"
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/fields/tabs/tabs.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

{% if count == 0 %}
{# Nothing to display #}
{% elseif count == 1 %}
{% elseif count == 1 and not admin %}
{% for field in (tabs|first).fields %}
{% if field.type %}
{% set value = field.name ? (form ? form.value(field.name) : data.value(field.name)) : data.toArray %}
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/fields/textarea/textarea.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
{% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}" %}{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
{% if required %}required="required"{% endif %}
{% if field.validate.pattern %}pattern="{{ field.validate.pattern }}"{% endif %}
{% if field.validate.message %}title="{{ field.validate.message|t|e }}"{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion templates/forms/fields/toggle/toggle.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
{% endif %}
{% endif %}
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}" %}{% endif %}
{% if field.tabindex %}tabindex="{{ field.tabindex }}"{% endif %}
/>
<label for="{{ id }}">{{ (macro.spanToggle(translation, maxLen)|trim)|raw }}</label>
{% endfor %}
Expand Down

0 comments on commit e090e82

Please sign in to comment.