{# TODO: See about grouping messages of the same type together if the amount gets out of hand. #}


{% if messages %}
  {% for message in messages %}
    {% if message.level == DEFAULT_MESSAGE_LEVELS.DEBUG %}

      <div class="alert alert-primary alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        {{ message }}
      </div>

    {% elif message.level == DEFAULT_MESSAGE_LEVELS.INFO %}

      <div class="alert alert-info alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        {{ message }}
      </div>

    {% elif message.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %}

      <div class="alert alert-success alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        {{ message }}
      </div>

    {% elif message.level == DEFAULT_MESSAGE_LEVELS.WARNING %}

      <div class="alert alert-warning alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        {{ message }}
      </div>

    {% elif message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}

      <div class="alert alert-danger alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        {{ message }}
      </div>

    {% else %}

      <div class="alert alert-default alert-dismissible">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        {{ message }}
      </div>
    {% endif %}

  {% endfor %}
{% endif %}
