Estructura de formularios
This commit is contained in:
parent
172f8b97cc
commit
a5d0a2a0be
7 changed files with 82 additions and 45 deletions
|
@ -1,25 +1,30 @@
|
|||
{%- assign name = include.field[0] -%}
|
||||
{%- assign id = include.field[1].id | default: name -%}
|
||||
{%- assign label = include.field[1].label[site.locale] -%}
|
||||
{%- assign help = include.field[1].help[site.locale] -%}
|
||||
{%- assign autocomplete = include.field[1].autocomplete -%}
|
||||
|
||||
<div class="form-check text-left">
|
||||
<input
|
||||
{% if include.field[1].help %}
|
||||
aria-describedby="help-{{ include.field[0] }}"
|
||||
{% if help %}
|
||||
aria-describedby="help-{{ id }}"
|
||||
{% endif %}
|
||||
{% if include.field[1].required %}
|
||||
required
|
||||
{% endif %}
|
||||
type="checkbox"
|
||||
name="{{ include.field[0] }}"
|
||||
id="{{ include.field[1].id | default: include.field[0] }}"
|
||||
name="{{ name }}"
|
||||
id="{{ id }}"
|
||||
{% if autocomplete %}
|
||||
autocomplete="{{ autocomplete }}"
|
||||
{% endif %}
|
||||
class="form-check-input" />
|
||||
|
||||
<label
|
||||
class="form-check-label"
|
||||
for="{{ include.field[1].id | default: include.field[0] }}">
|
||||
{{ include.field[1].label }}
|
||||
</label>
|
||||
<label class="form-check-label" for="{{ id }}">{{ label }}</label>
|
||||
|
||||
{%- if include.field[1].help -%}
|
||||
<small id="help-{{ include.field[0] }}" class="form-text">
|
||||
{{ include.field[1].help }}
|
||||
{%- if help -%}
|
||||
<small id="help-{{ id }}" class="form-text">
|
||||
{{ help }}
|
||||
</small>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
<input type="hidden" name="{{ include.field[0] }}" value="{{ include.field[1].value }}" />
|
||||
{%- assign name = include.field[0] -%}
|
||||
{%- assign id = include.field[1].id | default: name -%}
|
||||
{%- assign value = include.field[1].value -%}
|
||||
|
||||
<input type="hidden" value="{{ value }}" name="{{ name }}" id="{{ id }}" />
|
||||
|
|
|
@ -1,24 +1,33 @@
|
|||
{%- assign name = include.field[0] -%}
|
||||
{%- assign id = include.field[1].id | default: name -%}
|
||||
{%- assign label = include.field[1].label[site.locale] -%}
|
||||
{%- assign help = include.field[1].help[site.locale] -%}
|
||||
{%- assign autocomplete = include.field[1].autocomplete -%}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="{{ include.field[1].id | default: include.field[0] }}">
|
||||
<label for="{{ id }}">
|
||||
{{ label }}
|
||||
{% if include.field[1].required %}*{% endif %}
|
||||
{{ include.field[1].label }}
|
||||
</label>
|
||||
|
||||
<input
|
||||
{% if include.field[1].help %}
|
||||
aria-describedby="help-{{ include.field[0] }}"
|
||||
{% if help %}
|
||||
aria-describedby="help-{{ id }}"
|
||||
{% endif %}
|
||||
{% if include.field[1].required %}
|
||||
required
|
||||
{% endif %}
|
||||
type="{{ include.field[1].type }}"
|
||||
name="{{ include.field[0] }}"
|
||||
id="{{ include.field[1].id | default: include.field[0] }}"
|
||||
name="{{ name }}"
|
||||
id="{{ id }}"
|
||||
{% if autocomplete %}
|
||||
autocomplete="{{ autocomplete }}"
|
||||
{% endif %}
|
||||
class="form-control" />
|
||||
|
||||
{%- if include.field[1].help -%}
|
||||
<small id="help-{{ include.field[0] }}" class="form-text">
|
||||
{{ include.field[1].help }}
|
||||
{%- if help -%}
|
||||
<small id="help-{{ id }}" class="form-text">
|
||||
{{ help }}
|
||||
</small>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
{%- assign name = include.field[0] -%}
|
||||
{%- assign id = include.field[1].id | default: name -%}
|
||||
{%- assign label = include.field[1].label[site.locale] -%}
|
||||
{%- assign help = include.field[1].help[site.locale] -%}
|
||||
{%- assign autocomplete = include.field[1].autocomplete -%}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="{{ include.field[1].id | default: include.field[0] }}">
|
||||
<label for="{{ id }}">
|
||||
{{ label }}
|
||||
{% if include.field[1].required %}*{% endif %}
|
||||
{{ include.field[1].label }}
|
||||
</label>
|
||||
|
||||
<select
|
||||
{% if include.field[1].help %}
|
||||
aria-describedby="help-{{ include.field[0] }}"
|
||||
{% if help %}
|
||||
aria-describedby="help-{{ id }}"
|
||||
{% endif %}
|
||||
{% if include.field[1].required %}
|
||||
required
|
||||
{% endif %}
|
||||
name="{{ include.field[0] }}"
|
||||
id="{{ include.field[1].id | default: include.field[0] }}"
|
||||
name="{{ name }}"
|
||||
id="{{ id }}"
|
||||
{% if autocomplete %}
|
||||
autocomplete="{{ autocomplete }}"
|
||||
{% endif %}
|
||||
class="form-control">
|
||||
|
||||
<option value="" selected></option>
|
||||
|
@ -22,9 +31,9 @@
|
|||
{%- endfor -%}
|
||||
</select>
|
||||
|
||||
{%- if include.field[1].help -%}
|
||||
<small id="help-{{ include.field[0] }}" class="form-text">
|
||||
{{ include.field[1].help }}
|
||||
{%- if help -%}
|
||||
<small id="help-{{ id }}" class="form-text">
|
||||
{{ help }}
|
||||
</small>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
{% include input.html field=field %}
|
||||
{% assign f = field %}
|
||||
{% assign f.type = 'text' %}
|
||||
{% include input.html field=f %}
|
||||
|
|
|
@ -1 +1 @@
|
|||
<input type="submit" class="btn btn-success" value="{{ include.field[1].label }}" />
|
||||
<input type="submit" class="btn btn-success" value="{{ include.field[1].label[site.locale] }}" />
|
||||
|
|
|
@ -1,24 +1,32 @@
|
|||
{%- assign name = include.field[0] -%}
|
||||
{%- assign id = include.field[1].id | default: name -%}
|
||||
{%- assign label = include.field[1].label[site.locale] -%}
|
||||
{%- assign help = include.field[1].help[site.locale] -%}
|
||||
{%- assign autocomplete = include.field[1].autocomplete -%}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="{{ include.field[0] }}">
|
||||
<label for="{{ id }}">
|
||||
{% if include.field[1].required %}*{% endif %}
|
||||
{{ include.field[1].label }}
|
||||
{{ label }}
|
||||
</label>
|
||||
|
||||
<textarea
|
||||
{% if include.field[1].help %}
|
||||
aria-describedby="help-{{ include.field[0] }}"
|
||||
{% endif -%}
|
||||
{% if help %}
|
||||
aria-describedby="help-{{ id }}"
|
||||
{% endif %}
|
||||
{% if include.field[1].required %}
|
||||
required
|
||||
{% endif %}
|
||||
name="{{ include.field[0] }}"
|
||||
id="{{ include.field[1].id | default: include.field[0] }}"
|
||||
class="form-control">
|
||||
</textarea>
|
||||
name="{{ name }}"
|
||||
id="{{ id }}"
|
||||
{% if autocomplete %}
|
||||
autocomplete="{{ autocomplete }}"
|
||||
{% endif %}
|
||||
class="form-control"></textarea>
|
||||
|
||||
{%- if include.field[1].help -%}
|
||||
<small id="help-{{ include.field[0] }}" class="form-text">
|
||||
{{ include.field[1].help }}
|
||||
{%- if .help -%}
|
||||
<small id="help-{{ id }}" class="form-text">
|
||||
{{ help }}
|
||||
</small>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue