diff --git a/CHANGELOG.md b/CHANGELOG.md index 982f8017..3567f7d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,20 @@ +# v2.2.0 +## 03/13/2017 + +1. [](#new) + * Added new `fieldset` form field [#125](https://github.com/getgrav/grav-plugin-form/issues/125) + * Added new `conditional form field` to show fields only if some `condition` is set +1. [](#improved) + * Added the option to have outerclasses on buttons [#124](https://github.com/getgrav/grav-plugin-form/issues/124) + * Added the option to disable fields label if not defined [#126](https://github.com/getgrav/grav-plugin-form/issues/126) + # v2.1.1 ## 02/17/2017 1. [](#improved) * Better default output for select, checkbox and checkboxes fields in the form destination page and in the emails sent via form submit [#121](https://github.com/getgrav/grav-plugin-form/issues/121) + # v2.1.0 ## 02/10/2017 diff --git a/blueprints.yaml b/blueprints.yaml index f12c2aea..192aef1a 100644 --- a/blueprints.yaml +++ b/blueprints.yaml @@ -1,5 +1,5 @@ name: Form -version: 2.1.1 +version: 2.2.0 description: Enables the forms handling icon: check-square author: diff --git a/templates/forms/default/field.html.twig b/templates/forms/default/field.html.twig index 5b818898..b8d8d98f 100644 --- a/templates/forms/default/field.html.twig +++ b/templates/forms/default/field.html.twig @@ -7,18 +7,20 @@ {% block field %}
{% block contents %} -
- -
+ {% if field.label is not same as(false) %} +
+ +
+ {% endif %}
- {% endif %} - - {% if button.url %} - - {% endif %} + {% endfor %} {% block inner_markup_buttons_end %} diff --git a/templates/forms/fields/checkbox/checkbox.html.twig b/templates/forms/fields/checkbox/checkbox.html.twig index e2270f0a..f7b53ce5 100644 --- a/templates/forms/fields/checkbox/checkbox.html.twig +++ b/templates/forms/fields/checkbox/checkbox.html.twig @@ -24,6 +24,6 @@ {% endblock %} /> - +
{% endblock %} diff --git a/templates/forms/fields/conditional/conditional.html.twig b/templates/forms/fields/conditional/conditional.html.twig new file mode 100644 index 00000000..5cd861c2 --- /dev/null +++ b/templates/forms/fields/conditional/conditional.html.twig @@ -0,0 +1,18 @@ +{% if evaluate(field.condition) == 'true' %} + {% if field.classes %} +
+ {% endif %} + + {% if field.fields %} + {% for field in field.fields %} + {% if field.type %} + {% set value = data.value(field.name) %} + {% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %} + {% endif %} + {% endfor %} + {% endif %} + + {% if field.classes %} +
+ {% endif %} +{% endif %} diff --git a/templates/forms/fields/fieldset/fieldset.html.twig b/templates/forms/fields/fieldset/fieldset.html.twig new file mode 100644 index 00000000..36a30517 --- /dev/null +++ b/templates/forms/fields/fieldset/fieldset.html.twig @@ -0,0 +1,14 @@ +
+{% if field.legend %} + {% if grav.twig.twig.filters['tu'] is defined %}{{ field.legend|tu }}{% else %}{{ field.legend|t }}{% endif %} +{% endif %} + +{% if field.fields %} + {% for field in field.fields %} + {% if field.type %} + {% set value = data.value(field.name) %} + {% include ["forms/fields/#{field.type}/#{field.type}.html.twig", 'forms/fields/text/text.html.twig'] %} + {% endif %} + {% endfor %} +{% endif %} +
\ No newline at end of file diff --git a/templates/forms/fields/radio/radio.html.twig b/templates/forms/fields/radio/radio.html.twig index b4381d0a..5abf2630 100644 --- a/templates/forms/fields/radio/radio.html.twig +++ b/templates/forms/fields/radio/radio.html.twig @@ -16,7 +16,7 @@ {% if field.disabled or isDisabledToggleable %}disabled="disabled"{% endif %} {% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %} /> - + {% endfor %} {% endblock %}