mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-22 03:28:45 -06:00
Compare commits
2 Commits
main
...
19221-midd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3874944def | ||
|
|
ba6124f0e0 |
@@ -43,7 +43,7 @@ IMAGEATTACHMENT_IMAGE = """
|
|||||||
<a href="{{ record.image.url }}" target="_blank" class="image-preview" data-bs-placement="top">
|
<a href="{{ record.image.url }}" target="_blank" class="image-preview" data-bs-placement="top">
|
||||||
<i class="mdi mdi-image"></i></a>
|
<i class="mdi mdi-image"></i></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ record.get_absolute_url }}">{{ record }}</a>
|
<a href="{{ record.get_absolute_url }}">{{ record.filename|truncate_middle:16 }}</a>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
NOTIFICATION_ICON = """
|
NOTIFICATION_ICON = """
|
||||||
|
|||||||
@@ -252,3 +252,16 @@ def isodatetime(value, spec='seconds'):
|
|||||||
else:
|
else:
|
||||||
return ''
|
return ''
|
||||||
return mark_safe(f'<span title="{naturaltime(value)}">{text}</span>')
|
return mark_safe(f'<span title="{naturaltime(value)}">{text}</span>')
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def truncate_middle(value, length):
|
||||||
|
if len(value) <= length:
|
||||||
|
return value
|
||||||
|
|
||||||
|
# Calculate split points for the two parts
|
||||||
|
half_len = (length - 1) // 2 # 1 for the ellipsis
|
||||||
|
first_part = value[:half_len]
|
||||||
|
second_part = value[len(value) - (length - 1 - half_len):]
|
||||||
|
|
||||||
|
return mark_safe(f"{first_part}…{second_part}")
|
||||||
|
|||||||
Reference in New Issue
Block a user