Add optional input field illustration feather icon

This commit is contained in:
Alice Gaudon 2020-09-10 16:18:11 +02:00
parent b12d104c78
commit d3e3a86855
1 changed files with 47 additions and 36 deletions

View File

@ -32,7 +32,7 @@
<input type="hidden" name="csrf" value="{{ getCSRFToken() }}">
{% endmacro %}
{% macro field(_locals, type, name, value, placeholder, hint, validation_attributes='', extraData='') %}
{% macro field(_locals, type, name, value, placeholder, hint, validation_attributes='', extraData='', icon=null) %}
{% set validation = _locals.validation() %}
{% set validation = validation[name] if validation[name] or null %}
{% set previousFormData = _locals.previousFormData() %}
@ -45,6 +45,15 @@
<input type="hidden" name="{{ name }}" value="{{ value }}">
{% else %}
<div class="form-field{{ ' inline' if type == 'checkbox' }}">
<div class="control">
{% if icon != null %}
{% if icon.startsWith('fa') %}
<i class="{{ icon }} feather icon"></i>
{% else %}
<i data-feather="{{ icon }}" class="icon"></i>
{% endif %}
{% endif %}
{% if type == 'duration' %}
<div class="input-group">
{% for f in extraData %}
@ -81,6 +90,8 @@
{% endif %}
<label for="field-{{ name }}{{ '-' + extraData[0] if type == 'duration' }}">{{ placeholder }}</label>
</div>
{{ fieldError(_locals, name) }}
{% if hint %}
<div class="hint"><i data-feather="info"></i> {{ hint }}</div>