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

View File

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