feat(wagtail_hooks.py): add admin chat dashboard to wagtail admin menu
This commit is contained in:
@@ -1,7 +1,12 @@
|
|||||||
|
from wagtail.admin.menu import MenuItem
|
||||||
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
import wagtail.admin.rich_text.editors.draftail.features as draftail_features
|
||||||
from wagtail.admin.rich_text.converters.html_to_contentstate import BlockElementHandler
|
from wagtail.admin.rich_text.converters.html_to_contentstate import BlockElementHandler
|
||||||
from wagtail import hooks
|
from wagtail import hooks
|
||||||
|
|
||||||
|
from django.urls import path, reverse
|
||||||
|
|
||||||
|
from . import views
|
||||||
|
|
||||||
|
|
||||||
@hooks.register("register_rich_text_features")
|
@hooks.register("register_rich_text_features")
|
||||||
def register_code_block_feature(features):
|
def register_code_block_feature(features):
|
||||||
@@ -39,3 +44,20 @@ def register_code_block_feature(features):
|
|||||||
|
|
||||||
# Optional: add to default features
|
# Optional: add to default features
|
||||||
features.default_features.append(feature_name)
|
features.default_features.append(feature_name)
|
||||||
|
|
||||||
|
|
||||||
|
@hooks.register("register_admin_urls")
|
||||||
|
def register_admin_chat_dashboard_url():
|
||||||
|
return [
|
||||||
|
path("chat/", views.admin_chat_dashboard, name="admin_chat_dashboard"),
|
||||||
|
path(
|
||||||
|
"chat/user/<int:user_id>/",
|
||||||
|
views.admin_chat,
|
||||||
|
name="admin_chat",
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@hooks.register("register_admin_menu_item")
|
||||||
|
def register_admin_chat_menu_item():
|
||||||
|
return MenuItem("Chat", reverse("admin_chat_dashboard"), icon_name="mail")
|
||||||
|
|||||||
Reference in New Issue
Block a user