{% load i18n cms_tags extra_tags thumbnail %}

{% spaceless %}
{% if organization %}
    {% with organization_page=organization.extended_object %}
        <a href="{{ organization_page.get_absolute_url }}" title="{{ organization_page.get_title }}" class="subheader__cartouche">
            {% get_page_plugins "logo" organization_page as plugins or %}
                <div class="subheader__empty">{% trans "Main organization" %}</div>
            {% endget_page_plugins %}
            {% blockplugin plugins.0 %}
                <div class="subheader__media">
                    <img src="{% thumbnail instance.picture 200x113 upscale subject_location=instance.picture.subject_location %}"
                      srcset="
                        {% thumbnail instance.picture 200x113 upscale subject_location=instance.picture.subject_location %} 200w
                        {% if instance.picture.width >= 400 %},{% thumbnail instance.picture 400x225 upscale subject_location=instance.picture.subject_location %} 400w{% endif %}
                        {% if instance.picture.width >= 600 %},{% thumbnail instance.picture 600x338 upscale subject_location=instance.picture.subject_location %} 600w{% endif %}
                        {% if instance.picture.width >= 800 %},{% thumbnail instance.picture 800x450 upscale subject_location=instance.picture.subject_location %} 800w{% endif %}
                      "
                      sizes="30vw"
                      alt="{% if instance.picture.default_alt_text %}{{ instance.picture.default_alt_text }}{% else %}{% trans 'main organization logo' %}{% endif %}"
                    />
                </div>
            {% endblockplugin %}
        </a>
    {% endwith %}
{% else %}
    <div class="subheader__cartouche">
        <div class="subheader__empty">
            {% trans "Main organization" %}
        </div>
    </div>
{% endif %}
{% endspaceless %}
