{% macro attr_generator(attributes) %}
{% set attr = "" %}
{% for key , a in attributes %}
{% set attr = attr ~ " " ~ key ~ "=\"" ~ a|str_replace('"',"'") ~"\"" %}
{% endfor %}
{{ attr|raw }}
{% endmacro %}
{% macro button(text,attributes,type) %}
{% set cont_class = " btn waves-effect waves-light btn-"~type|default("default") %}
{% set attributes = attributes|default({}) %}
{% set attributes = attributes|merge({class: (attributes.class|default('') ~ cont_class)|trim}) -%}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-primary ')|trim}) -%}#}
{% if attributes.type is not defined %}
{% set attributes = attributes|merge({type: "button"}) -%}
{% endif %}
{% set attr = _self.attr_generator(attributes)|raw %}
{% if attributes.href is defined and attributes.href is not null %}
{{ text|raw }}
{% else %}
{% endif %}
{% endmacro %}
{% macro button_primary(text,attributes) %}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-primary ')|trim}) -%}#}
{{ _self.button(text,attributes,"primary") }}
{% endmacro %}
{% macro button_success(text,attributes) %}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-success ')|trim}) -%}#}
{{ _self.button(text,attributes,"success") }}
{% endmacro %}
{% macro button_warning(text,attributes) %}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-warning ')|trim}) -%}#}
{{ _self.button(text,attributes,"warning") }}
{% endmacro %}
{% macro button_danger(text,attributes) %}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-danger ')|trim}) -%}#}
{{ _self.button(text,attributes,"danger") }}
{% endmacro %}
{% macro button_info(text,attributes) %}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-info ')|trim}) -%}#}
{{ _self.button(text,attributes,"info") }}
{% endmacro %}
{% macro button_default(text,attributes) %}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-default ')|trim}) -%}#}
{{ _self.button(text,attributes) }}
{% endmacro %}
{% macro button_submit(attributes) %}
{% if attributes is not iterable %}
{% set attributes = {} %}
{% endif %}
{#{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' btn btn-default ')|trim}) -%}#}
{% set attributes = attributes|merge({type: 'submit'}) -%}
{% set text = "buttons.submit"|trans %}
{% if attributes.icon|default %} {% set text = '' %} {% endif %}
{{ _self.button_primary(" "~text,attributes) }}
{% endmacro %}
{% macro button_back_to_list(attributes) %}
{% set text = "buttons.back_to_list"|trans %}
{##}
{% set attributes = attributes|default({}) %}
{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' data-tooltip')|trim}) -%}
{% set attributes = attributes|merge({'data-original-title': text|trim}) -%}
{##}
{% if attributes.icon|default %} {% set text = '' %} {% endif %}
{{ _self.button_info(""~text,attributes) }}
{% endmacro %}
{% macro button_edit(attributes) %}
{% set text = "buttons.edit"|trans %}
{##}
{% set attributes = attributes|default({}) %}
{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' data-tooltip')|trim}) -%}
{% set attributes = attributes|merge({'data-original-title': text|trim}) -%}
{##}
{% if attributes.icon|default %} {% set text = '' %} {% endif %}
{{ _self.button_warning(""~text,attributes) }}
{% endmacro %}
{% macro button_delete(attributes) %}
{% set text = "buttons.delete"|trans %}
{##}
{% set attributes = attributes|default({}) %}
{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' data-tooltip')|trim}) -%}
{% set attributes = attributes|merge({'data-original-title': text|trim}) -%}
{##}
{% if attributes.icon|default %} {% set text = '' %} {% endif %}
{{ _self.button_danger(""~text,attributes) }}
{% endmacro %}
{% macro button_show(attributes) %}
{% set text = "buttons.show"|trans %}
{##}
{% set attributes = attributes|default({}) %}
{% set attributes = attributes|merge({class: (attributes.class|default('') ~ ' data-tooltip')|trim}) -%}
{% set attributes = attributes|merge({'data-original-title': text|trim}) -%}
{##}
{% if attributes.icon|default %} {% set text = '' %} {% endif %}
{{ _self.button_info(""~text,attributes) }}
{% endmacro %}
{% macro button_new(fields) %}
{{ fields.text|default }}
{% endmacro %}