mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Badges use secondary BG by default; add custom option
This commit is contained in:
parent
939bcfec4b
commit
65659fb676
@ -34,7 +34,7 @@
|
|||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<button class="nav-link" id="filters-form-tab" data-bs-toggle="tab" data-bs-target="#filters-form" type="button" role="tab" aria-controls="object-list" aria-selected="false">
|
<button class="nav-link" id="filters-form-tab" data-bs-toggle="tab" data-bs-target="#filters-form" type="button" role="tab" aria-controls="object-list" aria-selected="false">
|
||||||
Filters
|
Filters
|
||||||
{% if filter_form %}{% badge filter_form.changed_data|length %}{% endif %}
|
{% if filter_form %}{% badge filter_form.changed_data|length bg_class="primary" %}{% endif %}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -1 +1 @@
|
|||||||
{% if value or show_empty %}<span class="badge bg-primary">{{ value }}</span>{% endif %}
|
{% if value or show_empty %}<span class="badge bg-{{ bg_class }}">{{ value }}</span>{% endif %}
|
||||||
|
@ -386,12 +386,13 @@ def tag(tag, url_name=None):
|
|||||||
|
|
||||||
|
|
||||||
@register.inclusion_tag('utilities/templatetags/badge.html')
|
@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.
|
Display the specified number as a badge.
|
||||||
"""
|
"""
|
||||||
return {
|
return {
|
||||||
'value': value,
|
'value': value,
|
||||||
|
'bg_class': bg_class,
|
||||||
'show_empty': show_empty,
|
'show_empty': show_empty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user