{% macro warning(options = {}) %}
    {% set options = {type: 'warning'}|merge(options) %}
    {{ _self.custom(options) }}
{% endmacro %}

{% macro success(options = {}) %}
    {% set options = {type: 'success'}|merge(options) %}
    {{ _self.custom(options) }}
{% endmacro %}

{% macro info(options = {}) %}
    {% set options = {type: 'info'}|merge(options) %}
    {{ _self.custom(options) }}
{% endmacro %}

{% macro danger(options = {}) %}
    {% set options = {type: 'danger'}|merge(options) %}
    {{ _self.custom(options) }}
{% endmacro %}

{% macro custom(
    options = {}) -%}
    {% spaceless %}
        {% set options = {
            type: 'info',
            text:'',
            dissmiss: false,
            visible: true,
            translation_attributes: {},
            translation_domain: 'messages'
        }|merge(options) %}

        {% set class = "alert alert-" ~ options.type ~ ((not options.visible) ? " hidden" : '') %}
        <div class="{{ class }}">
            {{ options.dissmiss }}
            {% if options.dissmiss %}
                <button type="button" class="close" data-dismiss="alert">
                    <span aria-hidden="true">×</span>
                    <span class="sr-only">Close</span>
                </button>
            {% endif %}

            <span>
                {{ options.text|trans(options.translation_attributes, options.translation_domain) }}
            </span>
        </div>
    {% endspaceless %}
{%- endmacro %}