{% macro messages() -%}
  {% with messages = get_flashed_messages(with_categories=True) %}
    {% if messages %}
      {% for category, m in messages %}
        <div class="alert{% if category == 'error' %} alert-error{% endif %}">
          <a href="javascript:void(0)" class="close" data-dismiss="alert">x</a>
          {{ m }}
        </div>
      {% endfor %}
    {% endif %}
  {% endwith %}
{%- endmacro %}
