Move 'add child page' to its own primary action

pull/11069/head
Matt Westcott 2023-10-06 18:38:29 +01:00
rodzic b35f902daf
commit 58d6c137b4
2 zmienionych plików z 11 dodań i 1 usunięć

Wyświetl plik

@ -10,6 +10,12 @@
{% page_breadcrumbs parent_page 'wagtailadmin_explore' url_root_name='wagtailadmin_explore_root' is_expanded=parent_page.is_root classname='sm:w-py-3 lg:w-py-7' %}
{# Actions divider #}
<div class="w-w-px w-h-[30px] w-ml-auto sm:w-ml-0 w-bg-border-furniture"></div>
{% page_permissions parent_page as parent_page_perms %}
{% if parent_page_perms.can_add_subpage %}
<a href="{% url "wagtailadmin_pages:add_subpage" parent_page.id %}" class="button button-small bicolor button--icon button-secondary w-ml-3">{% icon name="plus" wrapped=1 %}{% trans "Add child page" %}</a>
{% endif %}
{# Page actions dropdown #}
{% page_header_buttons parent_page user=request.user view_name="index" %}
{% endblock %}

Wyświetl plik

@ -392,7 +392,11 @@ def page_listing_more_buttons(page, user, next_url=None):
@hooks.register("register_page_header_buttons")
def page_header_buttons(page, user, view_name, next_url=None):
yield PageListingEditButton(page=page, user=user, priority=10)
yield PageListingAddChildPageButton(page=page, user=user, priority=15)
# "add child" is a separate primary action on the index page
if view_name != "index":
yield PageListingAddChildPageButton(page=page, user=user, priority=15)
yield PageListingMoveButton(page=page, user=user, priority=20)
yield PageListingCopyButton(page=page, user=user, next_url=next_url, priority=30)
yield PageListingDeleteButton(page=page, user=user, next_url=next_url, priority=50)