From 65659fb676b7de24ae9fdc2d2e2733e3983279dc Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Fri, 6 Aug 2021 15:41:26 -0400 Subject: [PATCH] Badges use secondary BG by default; add custom option --- netbox/templates/generic/object_list.html | 2 +- netbox/templates/utilities/templatetags/badge.html | 2 +- netbox/utilities/templatetags/helpers.py | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index e2552c7c8..cbbdecd99 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -34,7 +34,7 @@ {% endif %} diff --git a/netbox/templates/utilities/templatetags/badge.html b/netbox/templates/utilities/templatetags/badge.html index 66493164e..4057eddc1 100644 --- a/netbox/templates/utilities/templatetags/badge.html +++ b/netbox/templates/utilities/templatetags/badge.html @@ -1 +1 @@ -{% if value or show_empty %}{{ value }}{% endif %} +{% if value or show_empty %}{{ value }}{% endif %} diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index a96f46422..700fb4369 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -386,12 +386,13 @@ def tag(tag, url_name=None): @register.inclusion_tag('utilities/templatetags/badge.html') -def badge(value, show_empty=False): +def badge(value, bg_class='secondary', show_empty=False): """ Display the specified number as a badge. """ return { 'value': value, + 'bg_class': bg_class, 'show_empty': show_empty, }