From 3bcc4e13bf2ebde84c195bc7afb078b4b111d9c5 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 2 Nov 2023 15:55:57 -0400 Subject: [PATCH] Use tooltips to display long strings --- netbox/netbox/tables/template_code.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/netbox/netbox/tables/template_code.py b/netbox/netbox/tables/template_code.py index 39a6863c6..24439eeb6 100644 --- a/netbox/netbox/tables/template_code.py +++ b/netbox/netbox/tables/template_code.py @@ -1,7 +1,18 @@ SEARCH_RESULT_ATTRS = """ {% for name, value in record.display_attrs.items %} - - {{ value|linkify }} + 40 %} data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ value }}"{% endif %} + > + {{ name|bettertitle }}: + {% with url=value.get_absolute_url %} + {% if url %}{% endif %} + {% if value|length > 40 %} + {{ value|truncatechars:"40" }} + {% else %} + {{ value }} + {% endif %} + {% if url %}{% endif %} + {% endwith %} {% endfor %} """