{% extends "django_design_system/footer.html" %}
{% load i18n wagtailimages_tags menu_tags l10n %}

{% block not_footer_brand %}
  {% translate "Back to home page" as back_to_home_label %}
  {% if settings.wagtail_design_system.WagtailDesignSystemConfig.operator_logo_file and settings.wagtail_design_system.WagtailDesignSystemConfig.operator_logo_alt %}
    {% image settings.wagtail_design_system.WagtailDesignSystemConfig.operator_logo_file original as logo_img %}
    <div class="design-system-footer__brand design-system-enlarge-link">
      <p class="gv-logo"
         title="{{ settings.wagtail_design_system.WagtailDesignSystemConfig.footer_brand|default:'république française' }}">
        {{ settings.wagtail_design_system.WagtailDesignSystemConfig.footer_brand_html| default_if_none:'république<br />française' | safe }}
      </p>
      <a class="design-system-footer__brand-link"
         href="/"
         title="{{ back_to_home_label }} - {{ settings.wagtail_design_system.WagtailDesignSystemConfig.operator_logo_alt }} - {{ settings.wagtail_design_system.WagtailDesignSystemConfig.footer_brand|default:'république française' }}">
        <img class="design-system-footer__logo"
             src="{{ logo_img.url }}"
             alt="{{ settings.wagtail_design_system.WagtailDesignSystemConfig.operator_logo_alt }}"
             {% if settings.wagtail_design_system.WagtailDesignSystemConfig.operator_logo_width >= 1 %}style="max-width:{{ settings.wagtail_design_system.WagtailDesignSystemConfig.operator_logo_width|unlocalize }}rem;"{% endif %} />
        {# L’alternative de l’image (attribut alt) doit impérativement être renseignée et reprendre le texte visible dans l’image #}
      </a>
    </div>
  {% else %}
    <div class="design-system-footer__brand design-system-enlarge-link">
      <a id="footer-operator"
         href="/"
         title="{{ back_to_home_label }} - {{ settings.wagtail_design_system.WagtailDesignSystemConfig.site_title }} - {{ settings.wagtail_design_system.WagtailDesignSystemConfig.footer_brand|default:'république française' }}">
        {% block brand %}
          <p class="gv-logo">
            {{ settings.wagtail_design_system.WagtailDesignSystemConfig.footer_brand_html| default_if_none:'république<br />française' | safe }}
          </p>
        {% endblock brand %}
      </a>
    </div>
  {% endif %}
{% endblock not_footer_brand %}

{% block footer_content %}
  {{ settings.wagtail_design_system.WagtailDesignSystemConfig.footer_description_wagtail | safe }}
{% endblock footer_content %}

{% block footer_links %}
  {% flat_menu handle="footer" template="menus/custom_flat_menu_footer.html" %}
  {% if settings.wagtail_design_system.WagtailDesignSystemConfig.theme_modale_button %}
    <li class="design-system-footer__bottom-item">
      <button id="footer__bottom-link__parametres-affichage"
              aria-controls="design-system-theme-modal"
              data-design-system-opened="false"
              class="design-system-icon-theme-fill design-system-link--icon-left design-system-footer__bottom-link"
              data-design-system-js-modal-button="true">{% translate "Display settings" %}</button>
    </li>
  {% endif %}
{% endblock footer_links %}
