{% extends 'wagtailadmin/bulk_actions/confirmation/base.html' %}
{% load i18n %}

{% block titletag %}{% blocktrans trimmed count counter=items|length %}Publish 1 page {% plural %}Publish {{ counter }} pages{% endblocktrans %}{% endblock %}

{% block header %}
    {% trans "Publish" as publish_str %}
    {% include "wagtailadmin/shared/header.html" with title=publish_str icon="doc-empty-inverse" %}
{% endblock header %}

{% block items_with_access %}
    {% if items %}
        <p>{% trans "Are you sure you want to publish these pages?" %}</p>
        <ul>
            {% for page in items %}
                <li>
                    <a href="{% url 'wagtailadmin_pages:edit' page.item.id %}" target="_blank" rel="noreferrer">{{ page.item.get_admin_display_title }}</a>
                    {% if page.draft_descendant_count %}
                        <p>
                            {% blocktrans trimmed count counter=page.draft_descendant_count %}
                                This page has one unpublished subpage
                            {% plural %}
                                This page has {{ counter }} unpublished subpages
                            {% endblocktrans %}
                        </p>
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    {% endif %}
{% endblock items_with_access %}

{% block items_with_no_access %}

    {% blocktrans trimmed asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to publish this page{% plural %}You don't have permission to publish these pages{% endblocktrans %}
    {% include './list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}

{% endblock items_with_no_access %}

{% block form_section %}
    {% if items %}
        {% trans 'Yes, publish' as action_button_text %}
        {% trans "No, don't publish" as no_action_button_text %}
        {% if has_draft_descendants %}
            {% include 'wagtailadmin/bulk_actions/confirmation/form_with_fields.html' %}
        {% else %}
            {% include 'wagtailadmin/bulk_actions/confirmation/form.html' %}
        {% endif %}
    {% else %}
        {% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
    {% endif %}
{% endblock form_section %}
