mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Introduce badge template tag
This commit is contained in:
parent
92c889ef9e
commit
a1e5a8b86a
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,
|
'tag': tag,
|
||||||
'url_name': url_name,
|
'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,
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user