{% macro errorList(errors) %} {% if errors %} {% endif %} {% endmacro %} {# Inputs #} {% macro textClass(config) %}{{ [ 'text', (config.class ? config.class : null), (config.hint ? 'nicetext' : null), (config.type == 'password' ? 'password' : null), (config.size ? null : 'fullwidth'), (config.errors ? 'error' : null) ]|filter|join(' ') }}{% endmacro %} {% macro text(config) %} {% set config = { id: null, class: null, type: 'text', size: null, maxlength: null, name: null, value: null, disabled: false, hint: null, errors: null }|merge(config) %} {% set class = _self.textClass(config) %} {% if config.type == 'password' %}
{% endif -%} {%- if config.type == 'password' %}
{% endif %} {% endmacro %} {% macro password(config) %} {{ _self.text(config|merge({ type: 'password' })) }} {% endmacro %} {% macro date(config) %}
{{ _self.text(config|merge({ size: 10 })) }}
{% set js %} $('#{{ config.id }}').datepicker({ dateFormat: $.datepicker.W3C, prevText: '{{ "Prev"|t|e('js') }}', nextText: '{{ "Next"|t|e('js') }}' }); {% endset %} {% includeJs js %} {% endmacro %} {% macro textarea(config) %} {% set config = { id: null, class: null, type: 'text', rows: 2, cols: 50, name: null, value: null, disabled: false, hint: null, errors: null }|merge(config) %} {% set class = _self.textClass(config) %} {{ config.value }} {% endmacro %} {% macro select(config) %} {% set config = { id: null, class: null, name: null, value: null, toggle: false, targetPrefix: null, disabled: false }|merge(config) %} {% set class = ['select', config.class]|filter|join(' ') %}
{% for value, label in config.options %} {% endfor %}
{% endmacro %} {% macro multiselect(config) %} {% set config = { id: null, name: null, size: null, options: [], values: [], disabled: false }|merge(config) %} {% for value, label in config.options %} {% endfor %} {% endmacro %} {% macro checkbox(config) %} {% set config = { id: null, class: null, name: null, value: '1', checked: false, toggle: null, disabled: false, label: null }|merge(config) %} {% set class = [ (config.class), (config.toggle ? 'fieldtoggle' : null) ]|filter|join(' ') %} {% endmacro %} {% macro checkboxGroup(config) %} {% set config = { id: null, name: null, options: [], values: [] }|merge(config) %} {% for value, label in config.options %}
{{ _self.checkbox({ label: label, id: (loop.first ? config.id : null), name: config.name ~ '[]', value: value, checked: (value in config.values) }) }}
{% endfor %} {% endmacro %} {% macro checkboxSelect(config) %} {% set config = { id: null, allLabel: "All"|t, name: null, options: [], values: [] }|merge(config) %}
{{ _self.checkbox({ id: config.id, class: 'all', label: '' ~ config.allLabel ~ '', checked: (config.values is empty) }) }}
{% for value, label in config.options %}
{{ _self.checkbox({ label: label, name: config.name ~ '[]', value: value, checked: (value in config.values or config.values is empty), disabled: (config.values is empty) }) }}
{% endfor %}
{% endmacro %} {% macro radio(config) %} {% set config = { id: null, class: null, name: null, value: '1', checked: false, disabled: false, label: null }|merge(config) %} {% endmacro %} {% macro radioGroup(config) %} {% set config = { id: null, name: null, options: [], value: null }|merge(config) %} {% for value, label in config.options %}
{{ _self.radio({ label: label, id: (loop.first ? config.id : null), name: config.name, value: value, checked: (value == config.value) }) }}
{% endfor %} {% endmacro %} {% macro file(config) %} {% set config = { id: null, name: null, disabled: false }|merge(config) %} {% endmacro %} {# Fields #} {% macro field(config, input) %} {% set config = { id: null, label: null, instructions: null, required: false, translatable: false, inputClass: null, errors: null }|merge(config) %}
{% if config.label or config.instructions %}
{% if config.label %} {{ config.label|raw }} {% if blx.hasPackage('Language') and config.translatable and blx.language != blx.app.language %} {% set localeName = blx.i18n.getLocaleName(blx.app.language) %} {{ "(in {language})"|t({ language: localeName }) }} {% endif %} {% endif %} {% if config.instructions %}

{{ config.instructions|raw }}

{% endif %}
{% endif %}
{{ input|raw }}
{{ _self.errorList(config.errors) }}
{% endmacro %} {% macro textField(config) %} {{ _self.field(config, _self.text(config)) }} {% endmacro %} {% macro passwordField(config) %} {{ _self.field(config, _self.password(config)) }} {% endmacro %} {% macro dateField(config) %} {{ _self.field(config, _self.date(config)) }} {% endmacro %} {% macro textareaField(config) %} {{ _self.field(config, _self.textarea(config)) }} {% endmacro %} {% macro selectField(config) %} {{ _self.field(config, _self.select(config)) }} {% endmacro %} {% macro multiselectField(config) %} {{ _self.field(config, _self.multiselect(config)) }} {% endmacro %} {% macro checkboxField(config) %} {% set config = { id: null }|merge(config) %}
{{ _self.checkbox(config) }}
{% endmacro %} {% macro checkboxSelectField(config) %} {{ _self.field(config, _self.checkboxSelect(config)) }} {% endmacro %} {% macro fileField(config) %} {{ _self.field(config, _self.file(config)) }} {% endmacro %}