This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
{% macro input_field(label, name, type='text', value='', required=false, placeholder='', autocomplete='', extra_class='', attrs='') -%}
|
||||
<label class="form-field {{ extra_class }}">
|
||||
<span class="form-field__label">{{ label }}</span>
|
||||
<input class="input"
|
||||
type="{{ type }}"
|
||||
name="{{ name }}"
|
||||
value="{{ value }}"
|
||||
{% if required %}required{% endif %}
|
||||
{% if placeholder %}placeholder="{{ placeholder }}"{% endif %}
|
||||
{% if autocomplete %}autocomplete="{{ autocomplete }}"{% endif %}
|
||||
{% if attrs %}{{ attrs|safe }}{% endif %} />
|
||||
</label>
|
||||
{%- endmacro %}
|
||||
{% macro textarea_field(label, name, value='', rows=3, placeholder='', extra_class='', attrs='') -%}
|
||||
<label class="form-field {{ extra_class }}">
|
||||
<span class="form-field__label">{{ label }}</span>
|
||||
<textarea class="input"
|
||||
name="{{ name }}"
|
||||
rows="{{ rows }}"
|
||||
{% if placeholder %} placeholder="{{ placeholder }}"{% endif %}
|
||||
{% if attrs %} {{ attrs|safe }}{% endif %}>{{ value }}</textarea>
|
||||
</label>
|
||||
{%- endmacro %}
|
||||
{% macro select_field(label, name, options, selected='', required=false, extra_class='', attrs='') -%}
|
||||
<label class="form-field {{ extra_class }}">
|
||||
<span class="form-field__label">{{ label }}</span>
|
||||
<select class="input"
|
||||
name="{{ name }}"
|
||||
{% if required %}required{% endif %}
|
||||
{% if attrs %}{{ attrs|safe }}{% endif %}>
|
||||
{% for option in options %}
|
||||
<option value="{{ option.value }}"
|
||||
{% if option.value == selected %}selected{% endif %}>{{ option.label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user