Skip to content

Commit

Permalink
Merge branch 'release/2.11.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Dec 18, 2017
2 parents 4aac832 + 446ddea commit e71623a
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 29 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# v2.11.1
## 12/18/2017

1. [](#improved)
* Updated default fields to make them more consistent with class names

# v2.11.0
## mm/dd/2017
## 12/05/2017

1. [](#new)
* Added ability to set `novalidate: true` on form definition to turn off all HTML5 form validation
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: 2.11.0
version: 2.11.1
description: Enables the forms handling
icon: check-square
author:
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 @@ -40,7 +40,7 @@
value="{{ value|join(', ')|e('html_attr') }}"
{# input attribute structures #}
{% block input_attributes %}
{% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
class="{{ form_field_input_classes }} {{ field.classes }}"
{% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions templates/forms/fields/checkbox/checkbox.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
{% endblock %}

{% block input %}
<div class="form-input-wrapper {{ field.size }} {{ field.wrapper_classes }}">
{% set id = field.id|default(field.name) ~ '-' ~ key %}
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<input
{# required attribute structures #}
name="{{ (scope ~ field.name)|fieldName }}"
Expand All @@ -14,16 +15,15 @@

{# input attribute structures #}
{% block input_attributes %}
id="{{ id|e }}"
{% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
{% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
{% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
{% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
{% endblock %}
/>

<label style="display:inline;" class="inline"{% if field.id is defined %} for="{{ field.id|e }}"{% endif %}>{{ field.label|t|e }} {{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}</label>
<label style="display:inline;" class="inline" for="{{ id|e }}">{{ field.label|t|e }} {{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}</label>
</div>
{% endblock %}
11 changes: 0 additions & 11 deletions templates/forms/fields/checkbox/checkbox.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions templates/forms/fields/checkboxes/checkboxes.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% set checked = (field.use == 'keys' ? value[key] : key in value) %}
{% set help = (key in field.help_options|keys ? field.help_options[key] : false) %}

<span class="checkboxes {{ field.wrapper_classes }}">
<div class="checkboxes {{ form_field_wrapper_classes }} {{ field.wrapper_classes }}">
<input type="checkbox"
id="{{ id|e }}"
value="{{ val|e }}"
Expand All @@ -38,6 +38,6 @@
{{ text|t|e }}
{% endif %}
</label>
</span>
</div>
{% endfor %}
{% endblock %}
2 changes: 1 addition & 1 deletion templates/forms/fields/file/file.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@


{% set settings = {name: field.name, paramName: (scope ~ field.name)|fieldName ~ (files.multiple ? '[]' : ''), limit: limit, filesize: form_max_filesize, accept: files.accept} %}
<div class="form-input-wrapper dropzone files-upload form-input-file {{ field.size }}" data-grav-file-settings="{{ settings|json_encode|e('html_attr') }}">
<div class="{{ form_field_wrapper_classes ?: 'form-input-wrapper' }} dropzone files-upload form-input-file {{ field.size }}" data-grav-file-settings="{{ settings|json_encode|e('html_attr') }}">
<input
{# required attribute structures #}
{% block input_attributes %}
Expand Down
4 changes: 2 additions & 2 deletions templates/forms/fields/radio/radio.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% for key, text in field.options %}
{% set id = field.id|default(field.name) ~ '-' ~ key %}

<span class="radio {{ field.wrapper_classes }}">
<div class="radio {{ form_field_wrapper_classes }} {{ field.wrapper_classes }}">
<input type="radio"
value="{{ key|e }}"
id="{{ id|e }}"
Expand All @@ -18,6 +18,6 @@
{% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
/>
<label style="display: inline" class="inline" for="{{ id|e }}">{% if grav.twig.twig.filters['tu'] is defined %}{{ text|tu|raw }}{% else %}{{ text|t|raw }}{% endif %}</label>
</span>
</div>
{% endfor %}
{% endblock %}
4 changes: 2 additions & 2 deletions templates/forms/fields/select/select.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
{% endblock %}

{% block input %}
<div class="form-select-wrapper {{ field.size }}">
<div class="{{ form_field_wrapper_classes ?: 'form-select-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<select name="{{ (scope ~ field.name)|fieldName ~ (field.multiple ? '[]' : '') }}"
{% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
class="{{ form_field_select_classes }} {{ field.classes }}"
{% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled %}disabled="disabled"{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
{% endblock %}

{% block input %}
<div class="form-select-wrapper {{ field.size }}">
<div class="{{ form_field_wrapper_classes ?: 'form-select-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<select name="{{ (scope ~ field.name)|fieldName ~ (field.multiple ? '[]' : '') }}"
{% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
class="{{ form_field_select_classes }} {{ field.classes }}"
{% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled %}disabled="disabled"{% endif %}
Expand Down
1 change: 1 addition & 0 deletions templates/forms/fields/switch/switch.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% extends 'forms/fields/checkbox/checkbox.html.twig' %}
4 changes: 2 additions & 2 deletions templates/forms/fields/textarea/textarea.html.twig
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "forms/field.html.twig" %}

{% block input %}
<div class="form-textarea-wrapper {{ field.size }}">
<div class="{{ form_field_wrapper_classes ?: 'form-textarea-wrapper' }} {{ field.size }} {{ field.wrapper_classes }}">
<textarea
{# required attribute structures #}
name="{{ (scope ~ field.name)|fieldName }}"
{# input attribute structures #}
{% block input_attributes %}
{% if field.classes is defined %}class="{{ field.classes }}" {% else %}class="{{ field.classes|default('input') }}" {% endif %}
class="{{ form_field_textarea_classes }} {{ field.classes }}"
{% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
{% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
{% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %}
Expand Down

0 comments on commit e71623a

Please sign in to comment.