macros: arguments are mostly defined, cleanup

This commit is contained in:
Igor Scheller 2023-05-11 16:57:45 +02:00 committed by Michael Weimann
parent 2e26f41964
commit b07f879d64
4 changed files with 7 additions and 7 deletions

View File

@ -36,9 +36,9 @@
{% macro button(label, url, type, size, title, icon_left, icon_right) %} {% macro button(label, url, type, size, title, icon_left, icon_right) %}
<a href="{{ url }}" class="btn btn-{{ type|default('secondary') }}{% if size %} btn-{{ size }}{% endif %}"{% if title %} title="{{ title }}"{% endif %}> <a href="{{ url }}" class="btn btn-{{ type|default('secondary') }}{% if size %} btn-{{ size }}{% endif %}"{% if title %} title="{{ title }}"{% endif %}>
{%- if icon_left is defined %}{{ _self.icon(icon_left) }}{% endif %} {%- if icon_left %}{{ _self.icon(icon_left) }}{% endif %}
{{ label }} {{ label }}
{%- if icon_right is defined %}{{ _self.icon(icon_right) }}{% endif %} {%- if icon_right %}{{ _self.icon(icon_right) }}{% endif %}
</a> </a>
{% endmacro %} {% endmacro %}

View File

@ -87,7 +87,7 @@ Also adds buttons to increment / decrement the value.
#} #}
{% macro number(name, label, opt) %} {% macro number(name, label, opt) %}
<div class="mb-3"> <div class="mb-3">
{% if label is defined -%} {% if label -%}
<label class="form-label" for="{{ name }}">{{ label }}</label> <label class="form-label" for="{{ name }}">{{ label }}</label>
{% if opt.required_icon|default(false) %} {% if opt.required_icon|default(false) %}
{{ _self.entry_required() }} {{ _self.entry_required() }}
@ -142,7 +142,7 @@ Also adds buttons to increment / decrement the value.
#} #}
{% macro textarea(name, label, opt) %} {% macro textarea(name, label, opt) %}
<div class="mb-3"> <div class="mb-3">
{% if label is defined -%} {% if label -%}
<label class="form-label" for="{{ name }}">{{ label }}</label> <label class="form-label" for="{{ name }}">{{ label }}</label>
{% if opt.required_icon|default(false) %} {% if opt.required_icon|default(false) %}
{{ _self.entry_required() }} {{ _self.entry_required() }}
@ -180,7 +180,7 @@ Renders a select element wrapped in a DIV with mb-3.
#} #}
{% macro select(name, label, data, opt) %} {% macro select(name, label, data, opt) %}
<div class="mb-3"> <div class="mb-3">
{% if label is defined -%} {% if label -%}
<label class="form-label" for="{{ name }}"> <label class="form-label" for="{{ name }}">
{{ label }} {{ label }}
{% if opt.required_icon|default(false) %} {% if opt.required_icon|default(false) %}

View File

@ -333,7 +333,7 @@
{{ f.button('Button') }} {{ f.button('Button') }}
</div> </div>
<div class="mb-3"> <div class="mb-3">
{{ f.button('Small button with icons', { {{ f.button('sm button with icons', {
'size': 'sm', 'size': 'sm',
'icon_left': 'check', 'icon_left': 'check',
'icon_right': 'info', 'icon_right': 'info',

View File

@ -21,7 +21,7 @@
'default_option': __('message.choose_angel'), 'default_option': __('message.choose_angel'),
}) }} }) }}
</div> </div>
<div class="col"> <div class="col-auto">
{{ f.submit(__('message.to_conversation'), {'btn_type': 'secondary'}) }} {{ f.submit(__('message.to_conversation'), {'btn_type': 'secondary'}) }}
</div> </div>
</div> </div>