mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-11 08:43:10 +00:00
Added search and redirects links to menu using hooks
This commit is contained in:
parent
217438ca37
commit
280bbff9d9
2 changed files with 26 additions and 0 deletions
|
|
@ -1,11 +1,24 @@
|
|||
from django.core import urlresolvers
|
||||
from django.conf.urls import include, url
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.wagtailadmin import hooks
|
||||
from wagtail.wagtailredirects import urls
|
||||
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
|
||||
|
||||
def register_admin_urls():
|
||||
return [
|
||||
url(r'^redirects/', include(urls)),
|
||||
]
|
||||
hooks.register('register_admin_urls', register_admin_urls)
|
||||
|
||||
|
||||
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)
|
||||
)
|
||||
hooks.register('construct_main_menu', construct_main_menu)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,24 @@
|
|||
from django.core import urlresolvers
|
||||
from django.conf.urls import include, url
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from wagtail.wagtailadmin import hooks
|
||||
from wagtail.wagtailsearch.urls import admin as admin_urls
|
||||
|
||||
from wagtail.wagtailadmin.menu import MenuItem
|
||||
|
||||
|
||||
def register_admin_urls():
|
||||
return [
|
||||
url(r'^search/', include(admin_urls)),
|
||||
]
|
||||
hooks.register('register_admin_urls', register_admin_urls)
|
||||
|
||||
|
||||
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)
|
||||
)
|
||||
hooks.register('construct_main_menu', construct_main_menu)
|
||||
|
|
|
|||
Loading…
Reference in a new issue