mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Standardize naming of menu items
This commit is contained in:
@ -11,7 +11,7 @@ from utilities.choices import ButtonColorChoices
|
||||
|
||||
# Initialize plugin registry stores
|
||||
registry['plugin_template_extensions'] = collections.defaultdict(list)
|
||||
registry['plugin_nav_menu_links'] = {}
|
||||
registry['plugin_menu_items'] = {}
|
||||
|
||||
|
||||
#
|
||||
@ -154,7 +154,7 @@ def register_template_extensions(class_list):
|
||||
|
||||
class PluginMenuItem:
|
||||
"""
|
||||
This class represents a nav menu item. This constitutes primary link and its text, but also allows for
|
||||
This class represents a navigation menu item. This constitutes primary link and its text, but also allows for
|
||||
specifying additional link buttons that appear to the right of the item in the van menu.
|
||||
|
||||
Links are specified as Django reverse URL strings.
|
||||
@ -172,8 +172,8 @@ class PluginMenuItem:
|
||||
|
||||
class PluginMenuButton:
|
||||
"""
|
||||
This class represents a button which is a part of the nav menu link item.
|
||||
Note that button colors should come from ButtonColorChoices
|
||||
This class represents a button within a PluginMenuItem. Note that button colors should come from
|
||||
ButtonColorChoices.
|
||||
"""
|
||||
color = ButtonColorChoices.DEFAULT
|
||||
|
||||
@ -199,4 +199,4 @@ def register_menu_items(section_name, class_list):
|
||||
if not isinstance(button, PluginMenuButton):
|
||||
raise TypeError(f"{button} must be an instance of extras.plugins.PluginMenuButton")
|
||||
|
||||
registry['plugin_nav_menu_links'][section_name] = class_list
|
||||
registry['plugin_menu_items'][section_name] = class_list
|
||||
|
@ -1,10 +1,10 @@
|
||||
from extras.registry import registry
|
||||
|
||||
|
||||
def nav_menu_links(request):
|
||||
def plugin_menu_items(request):
|
||||
"""
|
||||
Retrieve and expose all plugin registered nav links
|
||||
Retrieve and expose all plugin registered navigation menu items.
|
||||
"""
|
||||
return {
|
||||
'plugin_nav_menu_links': registry['plugin_nav_menu_links']
|
||||
'plugin_menu_items': registry['plugin_menu_items']
|
||||
}
|
||||
|
Reference in New Issue
Block a user