mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* WIP * Add display_attrs for all indexers * Linkify object attributes * Clean up prefetch logic * Use tooltips for display attributes * Simplify template code * Introduce get_indexer() utility function * Add to examples in docs * Use tooltips to display long strings
19 lines
555 B
Python
19 lines
555 B
Python
SEARCH_RESULT_ATTRS = """
|
|
{% for name, value in record.display_attrs.items %}
|
|
<span class="badge bg-secondary"
|
|
{% if value|length > 40 %} data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ value }}"{% endif %}
|
|
>
|
|
{{ name|bettertitle }}:
|
|
{% with url=value.get_absolute_url %}
|
|
{% if url %}<a href="url">{% endif %}
|
|
{% if value|length > 40 %}
|
|
{{ value|truncatechars:"40" }}
|
|
{% else %}
|
|
{{ value }}
|
|
{% endif %}
|
|
{% if url %}</a>{% endif %}
|
|
{% endwith %}
|
|
</span>
|
|
{% endfor %}
|
|
"""
|