mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
adds image preview on image attachment #12627
This commit is contained in:
parent
bf1c191b2e
commit
da9c5572bf
@ -22,6 +22,14 @@ __all__ = (
|
|||||||
'WebhookTable',
|
'WebhookTable',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
IMAGEATTACHMENT_IMAGE = '''
|
||||||
|
{% if record.image %}
|
||||||
|
<a class="image-preview" href="{{ record.image.url }}" target="_blank">{{ record }}</a>
|
||||||
|
{% else %}
|
||||||
|
—
|
||||||
|
{% endif %}
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
class CustomFieldTable(NetBoxTable):
|
class CustomFieldTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
@ -96,6 +104,9 @@ class ImageAttachmentTable(NetBoxTable):
|
|||||||
parent = tables.Column(
|
parent = tables.Column(
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
image = tables.TemplateColumn(
|
||||||
|
template_code=IMAGEATTACHMENT_IMAGE,
|
||||||
|
)
|
||||||
size = tables.Column(
|
size = tables.Column(
|
||||||
orderable=False,
|
orderable=False,
|
||||||
verbose_name='Size (bytes)'
|
verbose_name='Size (bytes)'
|
||||||
|
Loading…
Reference in New Issue
Block a user