only include add button in userbar if page allows subpages

This commit is contained in:
Eric Drechsel 2014-11-21 13:24:57 -08:00 committed by Karl Hobley
parent 805e078556
commit e28051e3f3
2 changed files with 3 additions and 3 deletions

View file

@ -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 %}

View file

@ -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 ""