mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 17:59:11 -06:00
Clean up & expand button color choices
This commit is contained in:
parent
ae3c871438
commit
9f53497e39
@ -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'),
|
||||
)
|
||||
|
||||
#
|
||||
|
@ -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(
|
||||
|
@ -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'),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user