0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Add collections settings menu item

This commit is contained in:
Matt Westcott 2015-09-08 18:33:22 +01:00
parent a2239e9f4a
commit e5a62eadda

View File

@ -4,6 +4,7 @@ from django.utils.translation import ugettext_lazy as _
from django.contrib.staticfiles.templatetags.staticfiles import static
from wagtail.wagtailcore import hooks
from wagtail.wagtailcore.permissions import collection_permission_policy
from wagtail.wagtailadmin.menu import MenuItem, SubmenuMenuItem, settings_menu
from wagtail.wagtailadmin.search import SearchArea
@ -41,3 +42,15 @@ def register_pages_search_area():
name='pages',
classnames='icon icon-folder-open-inverse',
order=100)
class CollectionsMenuItem(MenuItem):
def is_shown(self, request):
return collection_permission_policy.user_has_any_permission(
request.user, ['add', 'change', 'delete']
)
@hooks.register('register_settings_menu_item')
def register_collections_menu_item():
return CollectionsMenuItem(_('Collections'), urlresolvers.reverse('wagtailadmin_collections:index'), classnames='icon icon-folder-open-1', order=700)