diff --git a/netbox/extras/choices.py b/netbox/extras/choices.py index c01e64831..cf64bc005 100644 --- a/netbox/extras/choices.py +++ b/netbox/extras/choices.py @@ -1,4 +1,4 @@ -from utilities.choices import ChoiceSet +from utilities.choices import ButtonColorChoices, ChoiceSet # @@ -47,36 +47,13 @@ class CustomFieldFilterLogicChoices(ChoiceSet): # CustomLinks # -class CustomLinkButtonClassChoices(ChoiceSet): +class CustomLinkButtonClassChoices(ButtonColorChoices): - CLASS_DEFAULT = 'outline-dark' - CLASS_LINK = 'ghost-dark' - CLASS_BLUE = 'blue' - CLASS_INDIGO = 'indigo' - CLASS_PURPLE = 'purple' - CLASS_PINK = 'pink' - CLASS_RED = 'red' - CLASS_ORANGE = 'orange' - CLASS_YELLOW = 'yellow' - CLASS_GREEN = 'green' - CLASS_TEAL = 'teal' - CLASS_CYAN = 'cyan' - CLASS_GRAY = 'secondary' + LINK = 'ghost-dark' CHOICES = ( - (CLASS_DEFAULT, 'Default'), - (CLASS_LINK, 'Link'), - (CLASS_BLUE, 'Blue'), - (CLASS_INDIGO, 'Indigo'), - (CLASS_PURPLE, 'Purple'), - (CLASS_PINK, 'Pink'), - (CLASS_RED, 'Red'), - (CLASS_ORANGE, 'Orange'), - (CLASS_YELLOW, 'Yellow'), - (CLASS_GREEN, 'Green'), - (CLASS_TEAL, 'Teal'), - (CLASS_CYAN, 'Cyan'), - (CLASS_GRAY, 'Gray'), + *ButtonColorChoices.CHOICES, + (LINK, 'Link'), ) # diff --git a/netbox/extras/models/models.py b/netbox/extras/models/models.py index 5471f4d67..ac3a23410 100644 --- a/netbox/extras/models/models.py +++ b/netbox/extras/models/models.py @@ -212,7 +212,7 @@ class CustomLink(ChangeLoggedModel): button_class = models.CharField( max_length=30, choices=CustomLinkButtonClassChoices, - default=CustomLinkButtonClassChoices.CLASS_DEFAULT, + default=CustomLinkButtonClassChoices.DEFAULT, help_text="The class of the first link in a group will be used for the dropdown button" ) new_window = models.BooleanField( diff --git a/netbox/utilities/choices.py b/netbox/utilities/choices.py index 712783448..b500f5b9d 100644 --- a/netbox/utilities/choices.py +++ b/netbox/utilities/choices.py @@ -161,21 +161,34 @@ class ButtonColorChoices(ChoiceSet): Map standard button color choices to Bootstrap 3 button classes """ DEFAULT = 'outline-dark' - BLUE = 'primary' - CYAN = 'info' - GREEN = 'success' - RED = 'danger' - YELLOW = 'warning' - GREY = 'secondary' - BLACK = 'dark' + BLUE = 'blue' + INDIGO = 'indigo' + PURPLE = 'purple' + PINK = 'pink' + RED = 'red' + ORANGE = 'orange' + YELLOW = 'yellow' + GREEN = 'green' + TEAL = 'teal' + CYAN = 'cyan' + GRAY = 'gray' + GREY = 'gray' # Backward compatability for <3.2 + BLACK = 'black' + WHITE = 'white' CHOICES = ( (DEFAULT, 'Default'), (BLUE, 'Blue'), - (CYAN, 'Cyan'), - (GREEN, 'Green'), + (INDIGO, 'Indigo'), + (PURPLE, 'Purple'), + (PINK, 'Pink'), (RED, 'Red'), + (ORANGE, 'Orange'), (YELLOW, 'Yellow'), - (GREY, 'Grey'), - (BLACK, 'Black') + (GREEN, 'Green'), + (TEAL, 'Teal'), + (CYAN, 'Cyan'), + (GRAY, 'Gray'), + (BLACK, 'Black'), + (WHITE, 'White'), )