2018-10-25 01:35:53 +00:00
|
|
|
{% macro input_hidden(name, value) %}
|
|
|
|
{% spaceless %}
|
|
|
|
<input type="hidden" name="{{ name }}" value="{{ value }}">
|
|
|
|
{% endspaceless %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
2018-10-27 14:29:13 +00:00
|
|
|
{% macro input_csrf(realm, name) %}{# so we don't have to specify |raw every time #}
|
2018-10-25 01:35:53 +00:00
|
|
|
{% spaceless %}
|
|
|
|
{{ csrf_input(realm, name|default('csrf'))|raw }}
|
|
|
|
{% endspaceless %}
|
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro input_text(name, class, value, type, placeholder, required, attributes) %}
|
|
|
|
{% spaceless %}
|
|
|
|
<input type="{{ type|default('text') }}" {% if name|length > 0 %}name="{{ name }}"{% else %}readonly{% endif %}
|
|
|
|
class="input__text{% if name|length < 1 %} input__text--readonly{% endif %}{{ class|length > 0 ? ' ' ~ class : '' }}"
|
|
|
|
{% if placeholder|length > 0 %}placeholder="{{ placeholder }}"{% endif %}
|
|
|
|
{% if value|length > 0 %}value="{{ value }}"{% endif %}
|
|
|
|
{% if required|default(false) %}required{% endif %}
|
|
|
|
{% for name, value in attributes|default([]) %}
|
|
|
|
{{ name }}{% if value|length > 0 %}="{{ value }}"{% endif %}
|
|
|
|
{% endfor %}>
|
|
|
|
{% endspaceless %}
|
|
|
|
{% endmacro %}
|
2018-10-27 14:29:13 +00:00
|
|
|
|
|
|
|
{% macro input_checkbox(name, text, value, class) %}
|
|
|
|
{% spaceless %}
|
|
|
|
<label class="input__checkbox{{ class|length > 0 ? ' ' ~ class : '' }}">
|
|
|
|
<input type="checkbox" class="input__checkbox__input"
|
|
|
|
{% if name|length > 0 %}name="{{ name }}"{% endif %}
|
|
|
|
{% if value %}checked{% endif %}>
|
|
|
|
<div class="input__checkbox__display">
|
|
|
|
<div class="input__checkbox__display__icon"></div>
|
|
|
|
</div>
|
|
|
|
{% if text|length > 0 %}
|
|
|
|
<div class="input__checkbox__text">
|
|
|
|
{{ text }}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</label>
|
|
|
|
{% endspaceless %}
|
|
|
|
{% endmacro %}
|