{# Django messages / site app messages #}

{% load rules %}
{% load projectroles_tags %}
{% load projectroles_common_tags %}

{% get_site_app_messages request.user as site_app_messages %}

{% if messages or site_app_messages %}
  <div class="container-fluid sodar-alert-container">

  {# Site app messages #}
  {% for message in site_app_messages %}
    {% if request.user.is_authenticated or not message.require_auth %}
      <div class="alert alert-{{ message.color }} {% if message.dismissable %}alert-dismissable fade show{% endif %} sodar-alert-top sodar-alert-site-app">
        <div class="sodar-alert-top-content">
          {% comment %}
          {% if message.dismissable %}
            <a href="#" data-dismiss="alert" class="pull-right sodar-alert-close-link">
              <i class="iconify text-muted" data-icon="mdi:close-thick"></i>
            </a>
          {% endif %}
          {% endcomment %}
          {{ message.content | safe }}
        </div>
      </div>
    {% endif %}
  {% endfor %}

  {# Regular Django messages #}
  {% for message in messages %}
    <div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %} alert-dismissable fade show sodar-alert-top">
      <div class="sodar-alert-top-content">
        {{ message }}
        <a href="#" data-dismiss="alert" class="pull-right sodar-alert-close-link">
          <i class="iconify text-muted" data-icon="mdi:close-thick"></i>
        </a>
      </div>
    </div>
  {% endfor %}

  </div>
{% endif %}
