def main_nav(context): menu_items = [ MenuItem(_('Explorer'), '#', classnames='icon icon-folder-open-inverse dl-trigger', order=100), MenuItem(_('Search'), urlresolvers.reverse('wagtailadmin_pages_search'), classnames='icon icon-search', order=200), ] request = context['request'] for fn in hooks.get_hooks('construct_main_menu'): fn(request, menu_items) return { 'menu_items': sorted(menu_items, key=lambda i: i.order), 'request': request, }
def register_menu_settings(): return MenuItem( 'Relevancy', urlresolvers.reverse('wagtailrelevancy'), classnames='icon icon-doc-full', order=250 )
def register_django_admin_menu_item(): return MenuItem( 'Tags', reverse('admin:taggit_tag_changelist'), classnames='icon icon-folder-inverse', order=10000 )
def register_import_menu_item(): return MenuItem( 'Import content', reverse('import-content',), classnames='icon icon-collapse-up', order=1200 )
def register_language_menu_item(): return MenuItem( 'Languages', reverse('wagtailtrans_languages:index'), classnames='icon icon-snippet', order=1000, )
def register_export_menu_item(): return MenuItem( 'Export Ask data', reverse('export-ask'), classnames='icon icon-download', order=99999, )
def register_styleguide_menu_item(): return MenuItem( _('Analytics'), urlresolvers.reverse('wagalytics_dashboard'), classnames='icon icon-fa-bar-chart', order=1000 )
def get_submenu_items(self): items = super().get_submenu_items() for (title, urlname, icon) in reversed(self.menu_items): items.insert( 0, MenuItem(title, urlresolvers.reverse(urlname), classnames='icon icon-{0}'.format(icon), order=1)) for (idx, (title, urlname, icon)) in enumerate(self.menu_items_after): items.append( MenuItem(title, urlresolvers.reverse(urlname), classnames='icon icon-{0}'.format(icon), order=10000 + idx)) return items
def construct_main_menu(request, menu_items): if request.user.has_module_perms('auth'): menu_items.append( MenuItem(_('Users'), urlresolvers.reverse('wagtailusers_index'), classnames='icon icon-user', order=600))
def construct_main_menu(request, menu_items): if request.user.has_perm('wagtaildocs.add_document'): menu_items.append( MenuItem(_('Documents'), urlresolvers.reverse('wagtaildocs_index'), classnames='icon icon-doc-full-inverse', order=400))
def construct_main_menu(request, menu_items): if user_can_edit_snippets(request.user): menu_items.append( MenuItem(_('Snippets'), urlresolvers.reverse('wagtailsnippets_index'), classnames='icon icon-snippet', order=500))
def register_reports_menu_item(): return MenuItem( ('Reports'), urlresolvers.reverse('wagtailreports'), classnames='icon icon-wagtail', order=1000 )
def register_styleguide_menu_item(): return MenuItem( _('Resource Matcher'), urlresolvers.reverse('admin:index'), classnames='icon icon-fa-map-pin', order=1000 )
def register_export_menu_item(): return MenuItem( 'Enforcement actions', reverse('export-enforcement-actions'), classnames='icon icon-download', order=99999, )
def register_export_menu_item(): return MenuItem( 'Export content', reverse('export-content',), classnames='icon icon-collapse-down', order=1100 )
def register_django_admin_menu_item(): return MenuItem( 'Django Admin', reverse('admin:index'), classnames='icon icon-redirect', order=99999 )
def construct_main_menu(request, menu_items): if user_can_edit_invoices(request.user): menu_items.append( MenuItem(_('Invoices'), urlresolvers.reverse('wagtailinvoices_choose'), classnames='icon icon-plus', order=250))
def construct_main_menu(request, menu_items): # show this only if the user has permission to retrieve submissions for at least one form if get_forms_for_user(request.user).exists(): menu_items.append( MenuItem(_('Forms'), urlresolvers.reverse('wagtailforms_index'), classnames='icon icon-form', order=700))
def construct_main_menu(request, menu_items): # TEMPORARY: Only show if the user is a superuser if request.user.is_superuser: menu_items.append( MenuItem(_('Editors picks'), urlresolvers.reverse('wagtailsearch_editorspicks_index'), classnames='icon icon-pick', order=900))
def construct_main_menu(request, menu_items): # TEMPORARY: Only show if the user is a superuser if request.user.is_superuser: menu_items.append( MenuItem(_('Redirects'), urlresolvers.reverse('wagtailredirects_index'), classnames='icon icon-redirect', order=800))
def construct_main_menu(request, menu_items): if not OLD_STYLE_URLCONF_CHECK_PASSED: check_old_style_urlconf() if request.user.has_perm('wagtailimages.add_image'): menu_items.append( MenuItem(_('Images'), urlresolvers.reverse('wagtailimages_index'), classnames='icon icon-image', order=300))
def construct_main_menu(request, menu_items): if user_is_student(request.user): # remove Explorer and Search items from the menu. # assigning menu_items[:] will modify the list passed in menu_items[:] = [ item for item in menu_items if item.name not in ('explorer', 'search') ] # insert student page and RCA Now items in place menu_items.append( MenuItem('Profile', reverse('student_page_editor_index'), classnames='icon icon-user', order=100)) menu_items.append( MenuItem('Posts', reverse('rca_now_editor_index'), classnames='icon icon-doc-full-inverse', order=101))
def main_nav(context): menu_items = [ MenuItem('Explorer', '#', classnames='icon icon-folder-open-inverse dl-trigger', order=100), MenuItem('Search', urlresolvers.reverse('wagtailadmin_pages_search'), classnames='icon icon-search', order=200), ] request = context['request'] user = request.user if user.has_perm('wagtailimages.add_image'): menu_items.append( MenuItem('Images', urlresolvers.reverse('wagtailimages_index'), classnames='icon icon-image', order=300)) if user.has_perm('wagtaildocs.add_document'): menu_items.append( MenuItem('Documents', urlresolvers.reverse('wagtaildocs_index'), classnames='icon icon-doc-full-inverse', order=400)) if user_can_edit_snippets(user): menu_items.append( MenuItem('Snippets', urlresolvers.reverse('wagtailsnippets_index'), classnames='icon icon-snippet', order=500)) if user.has_module_perms('auth'): menu_items.append( MenuItem('Users', urlresolvers.reverse('wagtailusers_index'), classnames='icon icon-user', order=600)) for fn in hooks.get_hooks('construct_main_menu'): fn(request, menu_items) return { 'menu_items': sorted(menu_items, key=lambda i: i.order), 'request': request, }
def test_menuitem_reverse_lazy_url_pass(self): menuitem = MenuItem(_('Test'), reverse_lazy('wagtailadmin_home')) self.assertEqual(menuitem.is_active(self.request), True)
def construct_main_menu(request, menu_items): if request.user.has_perm('wagtailimages.add_image'): menu_items.append( MenuItem(_('Images'), urlresolvers.reverse('wagtailimages_index'), classnames='icon icon-image', order=300) )
def register_layers_menu_item(): return MenuItem('Layers', reverse('layers:index'), classnames="icon icon-site")
def register_frank_menu_item(): return MenuItem('YubiKey', reverse('yubikey-setup'), classnames='icon icon-password', order=10000)
def register_frank_menu_item(): return MenuItem('Clear Cache', reverse('admin_clear_cache'), classnames='icon icon-cross', order=10000)
def register_variables_menu_item(): return MenuItem('Variables', reverse('variables:index'), classnames="icon icon-placeholder")
def register_user_guide_menu_item(): return MenuItem('Site Guide', reverse('site_guide'), classnames="icon icon-placeholder")
def test_menuitem_reverse_lazy_url_pass(self): menuitem = MenuItem(_('Test'), reverse_lazy('wagtailadmin_home')) self.assertEqual(menuitem.is_active(self.request), True)