{% extends "admin/base.html" %}
{% load static admin_urls crispy_forms_tags i18n unfold %}

{# Ensure Unfold navigation renders branding/icon even for Fobi templates #}
{% block branding %}{% trans "Django administration" as default_branding %}{{ site_header|default:default_branding }}{% endblock %}

{% block extrahead %}
    {{ block.super }}
    <script src="{% url 'admin:jsi18n' %}"></script>
    {# Fobi theme javascripts #}
    {% block theme-javascripts %}
        {% for js_file in fobi_theme.get_media_js %}
        <script src="{{ js_file }}"></script>
        {% endfor %}
    {% endblock theme-javascripts %}
{% endblock %}

{% block content %}
    {# Default content when child templates don't override content-wrapper #}
    {% block content-wrapper %}
        {% block object-tools %}{% endblock %}
    {% endblock %}
{% endblock %}

{# Match Django native related-widget popup behavior: no admin nav sidebar. #}
{% block nav-sidebar %}
    {% if not is_popup and "_popup" not in request.GET and "_popup" not in request.POST %}
        {{ block.super }}
    {% endif %}
{% endblock %}

{# Render Fobi's optional sidebar content inside Unfold's sidebar slot #}
{% block sidebar %}
    {% block sidebar-wrapper %}{% endblock %}
{% endblock %}
