mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Introduce badge template tag
This commit is contained in:
netbox
1
netbox/templates/utilities/templatetags/badge.html
Normal file
1
netbox/templates/utilities/templatetags/badge.html
Normal file
@ -0,0 +1 @@
|
||||
{% if value or show_empty %}<span class="badge">{{ value }}</span>{% endif %}
|
@ -242,3 +242,14 @@ def tag(tag, url_name=None):
|
||||
'tag': tag,
|
||||
'url_name': url_name,
|
||||
}
|
||||
|
||||
|
||||
@register.inclusion_tag('utilities/templatetags/badge.html')
|
||||
def badge(value, show_empty=False):
|
||||
"""
|
||||
Display the specified number as a badge.
|
||||
"""
|
||||
return {
|
||||
'value': value,
|
||||
'show_empty': show_empty,
|
||||
}
|
||||
|
Reference in New Issue
Block a user