{% load i18n wagtailadmin_tags %}

{% test_collection_is_public collection as is_public %}

{% if not collection.is_root %}
    {% trans 'Change privacy' as set_privacy_title %}
    {% trans 'Privacy settings determine who is able to view documents in this collection.' as privacy_message_text %}
    {% url 'wagtailadmin_collections:set_privacy' collection.id as privacy_url %}
    {% dialog icon_name='view' id='set-privacy' data_url=privacy_url title=set_privacy_title message_status='info' message_heading=privacy_message_text %}
    {% enddialog %}

    <div class="privacy-indicator {% if is_public %}public{% else %}private{% endif %}">
        {% trans "Privacy" %}
        <button type="button" data-a11y-dialog-show="set-privacy" class="status-tag primary">
            {# labels are shown/hidden in CSS according to the 'private' / 'public' class on view-permission-indicator #}
            <span class="label-public icon icon-view" aria-label="{% trans 'Set collection privacy. Current status: Public' %}">
                {% trans "Public" %}
            </span>
            <span class="label-private icon icon-no-view" aria-label="{% trans 'Set collection privacy. Current status: Private' %}">
                {% trans "Private" %}
            </span>
        </button>
    </div>
{% endif %}
