{% extends "admin/cms/page/tree/base.html" %}

{% load i18n static admin_urls cms_static unfold_extra_tags %}

{% block bodyclass %}{{ block.super }}{% unfold_cms_header_add_button as header_add %}{% if header_add %} unfold-header-add{% endif %}{% endblock %}

{% block extrahead %}
    {#    {{ block.super }} #NOTE: avoid super call to prevent loading of original css and js#}
    <link rel="stylesheet" href="{% static_with_version 'cms/css/cms.base.css' %}">
    <link rel="stylesheet" href="{% static 'unfold_extra/cms/css/cms.pagetree.css' %}">
    <script src="{% static_with_version 'cms/js/dist/bundle.admin.base.min.js' %}"></script>
    <script src="{% static_with_version 'cms/js/dist/bundle.admin.pagetree.min.js' %}"></script>
{% endblock extrahead %}

{% block object-tools-items %}
    {% unfold_cms_header_add_button as header_add %}
    {% if header_add and has_add_permission %}
        <div class="flex flex-row items-center">
            <a href="{% url opts|admin_urlname:'add' %}?language={{ preview_language }}"
               class="addlink bg-primary-600 flex items-center h-[38px] justify-center -my-1 rounded-full w-[38px]"
               title="{% trans 'New Page' %}">
                <span class="material-symbols-outlined text-white">add</span>
            </a>
        </div>
    {% endif %}
{% endblock %}

{% block breadcrumbs %}
    {% if not is_popup %}
        <div class="px-4 lg:px-8">
            <div class="container mb-6 mx-auto -my-3 lg:mb-12">
                <ul class="flex flex-wrap">
                    {% url 'admin:index' as link %}
                    {% trans 'Home' as name %}
                    {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=name %}

                    {% url 'admin:app_list' app_label='cms' as link %}
                    {% include 'unfold/helpers/breadcrumb_item.html' with link=link name=opts.app_config.verbose_name %}

                    {% trans "Pages" as name %}
                    {% include 'unfold/helpers/breadcrumb_item.html' with link=None name=name %}
                </ul>
            </div>
        </div>
    {% endif %}
{% endblock %}
