{% with messages = get_flashed_messages(with_categories=True) %}
  {% for category, message in messages %}
    {% if category == 'message' %}
      {% set category = 'info' %}
    {% endif %}
    {% if category == 'error' %}
      {% set icon = 'icon fa fa-ban' %}
    {% elif category == 'success' %}
      {% set icon = 'icon fa fa-check' %}
    {% else %}
      {% set icon = 'icon fa fa-info' %}
    {% endif %}
    {% if category != 'error_details' %}
      <div class="alert alert-{{ category }} alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
        <h4><i class="{{ icon }}"></i> {{ category|title }}!</h4>
        {{ message }}
        {% for message in get_flashed_messages(category_filter=['error_details']) %}
          <div id="error-details-show">
            > Details
          </div>
          <div id="error-details-hide" style="display: none;">
            ^ Details
            <div id="error-details">
            {{ message }}
            </div>
          </div>
        {% endfor %}
      </div>
    {% endif %}
  {% endfor %}
{% endwith %}
