mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-18 20:21:11 +00:00
only include add button in userbar if page allows subpages
This commit is contained in:
parent
805e078556
commit
e28051e3f3
2 changed files with 3 additions and 3 deletions
|
|
@ -2,5 +2,5 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% block item_content %}
|
||||
<a href="{% url 'wagtailadmin_pages_add_subpage' self.parent_page.id %}" target="_parent" class="action icon icon-plus" title="{% trans 'Add another page at this level' %}">{% trans 'Add' %}</a>
|
||||
{% endblock %}
|
||||
<a href="{% url 'wagtailadmin_pages_add_subpage' self.page.id %}" target="_parent" class="action icon icon-plus" title="{% trans 'Add a child page' %}">{% trans 'Add' %}</a>
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class AddPageItem(BaseItem):
|
|||
return ""
|
||||
|
||||
# Don't render if user doesn't have ability to add siblings
|
||||
permission_checker = self.page.get_parent().permissions_for_user(request.user)
|
||||
permission_checker = self.page.permissions_for_user(request.user)
|
||||
if not permission_checker.can_add_subpage():
|
||||
return ""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue