Skip to content

Commit

Permalink
Form 1.1.1
Browse files Browse the repository at this point in the history
- translating titles for form submit button + missed files.
  • Loading branch information
Awilum committed Jun 10, 2020
1 parent c0b5cbe commit a40668b
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 4 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="1.1.1"></a>
# [1.1.1](https://github.com/flextype-plugins/form/compare/v1.1.0...v1.1.1) (2020-06-10)

### Bug Fixes

* **fieldsets:** fix translating titles for form submit button.

<a name="1.1.0"></a>
# [1.1.0](https://github.com/flextype-plugins/form/compare/v1.0.6...v1.1.0) (2020-06-10)

Expand All @@ -16,8 +23,8 @@

### Features

* **feat(fields):** add new fields `email` and `password`
* **feat(fields):** add basic html validation for fields `text, email, password, textarea`
* **fields:** add new fields `email` and `password`
* **fields:** add basic html validation for fields `text, email, password, textarea`

Usage:

Expand Down
33 changes: 33 additions & 0 deletions fieldsets/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% set sizes =
{
'1/12': 'form-col form-w-1/12',
'2/12': 'form-col form-w-2/12',
'3/12': 'form-col form-w-3/12',
'4/12': 'form-col form-w-4/12',
'5/12': 'form-col form-w-5/12',
'6/12': 'form-col form-w-6/12',
'7/12': 'form-col form-w-7/12',
'8/12': 'form-col form-w-8/12',
'9/12': 'form-col form-w-9/12',
'10/12': 'form-col form-w-10/12',
'12/12': 'form-col form-w-full',
'12': 'form-col form-w-full'
}
%}

<div class="form-wrapper {% if fieldset.size %}{{ sizes[fieldset.size] }}{% else %}{{ sizes[12] }}{% endif %}">
{% if fieldset.form.tabs %}
<nav class="form-tabs__nav">
<div class="form-tabs__nav__links">
{% for key, section in fieldset.form.tabs %}
<a href="javascript:;" class="form-tabs__nav__link {% if key == 'main' %} form-tabs__nav__link--active {% endif %}">{{ tr(section.title) }}</a>
{% endfor %}
</div>
</nav>
<div class="form-tabs">
{% include "plugins/form/fieldsets/multi-form.html" %}
</div>
{% else %}
{% include "plugins/form/fieldsets/single-form.html" %}
{% endif %}
</div>
25 changes: 25 additions & 0 deletions fieldsets/multi-form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<form action="{% if fieldset.form.action %}{{ path_for(fieldset.form.action) }}{% endif %}"
method="{% if fieldset.form.method %}{{ fieldset.form.method }}{% else %}post{% endif %}"
{% if fieldset.form.id %}id="form-{{ fieldset.form.id }}"{% endif %}
{% if fieldset.form.name %}id="form-{{ fieldset.form.name }}"{% endif %}>
{{ csrf() }}
<input type="hidden" id="form-save-action" name="form-save-action" value="form-save-action">
{% for key, tab in fieldset.form.tabs %}
<div class="form-tabs__content {% if key == 'main' %} form-tabs__content--active {% endif %}">
<div class="form-row">
{% for element, properties in fieldset['form']['tabs'][key]['fields'] %}

{% set field_name = form.getElementName(element) %}
{% set field_id = form.getElementID(element) %}
{% set field_value = form.getElementValue(element, values, properties) %}

{% include "plugins/form/fieldsets/fields/fields.html" %}

{% endfor %}
</div>
</div>
{% endfor %}
{% if fieldset.form.submit %}
<input type="submit" value="{{ tr(fieldset.form.submit.title) }}" class="form-button {{ fieldset.form.submit.class }}">
{% endif %}
</form>
20 changes: 20 additions & 0 deletions fieldsets/single-form.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<form action="{% if fieldset.form.action %}{{ path_for(fieldset.form.action) }}{% endif %}"
method="{% if fieldset.form.method %}{{ fieldset.form.method }}{% else %}post{% endif %}"
{% if fieldset.form.id %}id="form-{{ fieldset.form.id }}"{% endif %}
{% if fieldset.form.name %}id="form-{{ fieldset.form.name }}"{% endif %}>
{{ csrf() }}
<input type="hidden" id="form-save-action" name="form-save-action" value="form-save-action">
<div class="form-row">
{% for element, properties in fieldset.form.fields %}

{% set field_name = form.getElementName(element) %}
{% set field_id = form.getElementID(element) %}
{% set field_value = form.getElementValue(element, values, properties) %}

{% include "plugins/form/fieldsets/fields/fields.html" %}
{% endfor %}
</div>
{% if fieldset.form.submit %}
<input type="submit" value="{{ tr(fieldset.form.submit.title) }}" class="form-button {{ fieldset.form.submit.class }}">
{% endif %}
</form>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Form",
"version": "1.1.0",
"version": "1.1.1",
"description": "Form Plugin to render user forms for Flextype.",
"homepage": "https://flextype.org",
"author": "Sergey Romanenko",
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Form
version: 1.1.0
version: 1.1.1
description: Form Plugin to render user forms for Flextype.
icon: fas fa-check-circle
author:
Expand Down

0 comments on commit a40668b

Please sign in to comment.