diff --git a/docs/plugins/development.md b/docs/plugins/development.md index 1599a8c53..756dd537a 100644 --- a/docs/plugins/development.md +++ b/docs/plugins/development.md @@ -284,7 +284,7 @@ With these three components in place, we can request `/api/plugins/animal-sounds To make its views easily accessible to users, a plugin can inject items in NetBox's navigation menu under the "Plugins" header. Menu items are added by defining a list of PluginMenuItem instances. By default, this should be a variable named `menu_items` in the file `navigation.py`. An example is shown below. ```python -from extras.plugins import PluginNavMenuButton, PluginMenuItem +from extras.plugins import PluginMenuButton, PluginMenuItem from utilities.choices import ButtonColorChoices menu_items = ( @@ -292,8 +292,8 @@ menu_items = ( link='plugins:netbox_animal_sounds:random_sound', link_text='Random sound', buttons=( - PluginNavMenuButton('home', 'Button A', 'fa-info', ButtonColorChoices.BLUE), - PluginNavMenuButton('home', 'Button B', 'fa-warning', ButtonColorChoices.GREEN), + PluginMenuButton('home', 'Button A', 'fa-info', ButtonColorChoices.BLUE), + PluginMenuButton('home', 'Button B', 'fa-warning', ButtonColorChoices.GREEN), ) ), ) @@ -304,10 +304,10 @@ A `PluginMenuItem` has the following attributes: * `link` - The name of the URL path to which this menu item links * `link_text` - The text presented to the user * `permission` - The name of the permission required to display this link (optional) -* `buttons` - An iterable of PluginNavMenuButton instances to display (optional) +* `buttons` - An iterable of PluginMenuButton instances to display (optional) -A `PluginNavMenuButton` has the following attributes: +A `PluginMenuButton` has the following attributes: * `link` - The name of the URL path to which this button links * `title` - The tooltip text (displayed when the mouse hovers over the button) diff --git a/netbox/extras/plugins/__init__.py b/netbox/extras/plugins/__init__.py index 4891dce4c..b133f83a0 100644 --- a/netbox/extras/plugins/__init__.py +++ b/netbox/extras/plugins/__init__.py @@ -158,7 +158,7 @@ class PluginMenuItem: specifying additional link buttons that appear to the right of the item in the van menu. Links are specified as Django reverse URL strings. - Buttons are each specified as a list of PluginNavMenuButton instances. + Buttons are each specified as a list of PluginMenuButton instances. """ def __init__(self, link, link_text, permission=None, buttons=None): self.link = link @@ -170,7 +170,7 @@ class PluginMenuItem: self.buttons = buttons -class PluginNavMenuButton: +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 @@ -196,7 +196,7 @@ def register_menu_items(section_name, class_list): if not isinstance(menu_link, PluginMenuItem): raise TypeError(f"{menu_link} must be an instance of extras.plugins.PluginMenuItem") for button in menu_link.buttons: - if not isinstance(button, PluginNavMenuButton): - raise TypeError(f"{button} must be an instance of extras.plugins.PluginNavMenuButton") + 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