Use tooltips to display long strings

This commit is contained in:
Jeremy Stretch 2023-11-02 15:55:57 -04:00
parent 326c954782
commit 3bcc4e13bf

View File

@ -1,7 +1,18 @@
SEARCH_RESULT_ATTRS = """ SEARCH_RESULT_ATTRS = """
{% for name, value in record.display_attrs.items %} {% for name, value in record.display_attrs.items %}
<span class="badge bg-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ name|bettertitle }}"> <span class="badge bg-secondary"
{{ value|linkify }} {% 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> </span>
{% endfor %} {% endfor %}
""" """