diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index 7c2359db5..9d1868e1e 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -290,22 +290,7 @@ {% endif %} -
-
- Images -
-
- {% include 'inc/image_attachments.html' with images=object.images.all %} -
- {% if perms.extras.add_imageattachment %} - - {% endif %} -
+ {% include 'inc/image_attachments_panel.html' %}
Related Devices diff --git a/netbox/templates/dcim/location.html b/netbox/templates/dcim/location.html index d0e981e5a..b062ddcb5 100644 --- a/netbox/templates/dcim/location.html +++ b/netbox/templates/dcim/location.html @@ -59,22 +59,7 @@
{% include 'inc/custom_fields_panel.html' %} -
-
- Images -
-
- {% include 'inc/image_attachments.html' with images=object.images.all %} -
- {% if perms.extras.add_imageattachment %} - - {% endif %} -
+ {% include 'inc/image_attachments_panel.html' %} {% plugin_right_page object %}
diff --git a/netbox/templates/dcim/rack.html b/netbox/templates/dcim/rack.html index 87c20999f..bf9a11819 100644 --- a/netbox/templates/dcim/rack.html +++ b/netbox/templates/dcim/rack.html @@ -210,22 +210,7 @@ {% endif %} -
-
- Images -
-
- {% include 'inc/image_attachments.html' with images=object.images.all %} -
- {% if perms.extras.add_imageattachment %} - - {% endif %} -
+ {% include 'inc/image_attachments_panel.html' %}
Reservations diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html index 36ed9bff4..1ee8cfce0 100644 --- a/netbox/templates/dcim/site.html +++ b/netbox/templates/dcim/site.html @@ -242,22 +242,7 @@ {% endif %}
-
-
- Images -
-
- {% include 'inc/image_attachments.html' with images=object.images.all %} -
- {% if perms.extras.add_imageattachment %} - - {% endif %} -
+ {% include 'inc/image_attachments_panel.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/inc/image_attachments.html b/netbox/templates/inc/image_attachments.html deleted file mode 100644 index 5ec47af7e..000000000 --- a/netbox/templates/inc/image_attachments.html +++ /dev/null @@ -1,38 +0,0 @@ -{% load helpers %} - -{% if images %} - - - - - - - - {% for attachment in images %} - - - - - - - {% endfor %} -
NameSizeCreated
- - {{ attachment }} - {{ attachment.size|filesizeformat }}{{ attachment.created|annotated_date }} - {% if perms.extras.change_imageattachment %} - - - - {% endif %} - {% if perms.extras.delete_imageattachment %} - - - - {% endif %} -
-{% else %} -
- None -
-{% endif %} diff --git a/netbox/templates/inc/image_attachments_panel.html b/netbox/templates/inc/image_attachments_panel.html new file mode 100644 index 000000000..ca7312901 --- /dev/null +++ b/netbox/templates/inc/image_attachments_panel.html @@ -0,0 +1,52 @@ +{% load helpers %} + +
+
+ Images +
+
+ {% with images=object.images.all %} + {% if images.exists %} + + + + + + + + {% for attachment in images %} + + + + + + + {% endfor %} +
NameSizeCreated
+ + {{ attachment }} + {{ attachment.size|filesizeformat }}{{ attachment.created|annotated_date }} + {% if perms.extras.change_imageattachment %} + + + + {% endif %} + {% if perms.extras.delete_imageattachment %} + + + + {% endif %} +
+ {% else %} +
None
+ {% endif %} + {% endwith %} +
+ {% if perms.extras.add_imageattachment %} + + {% endif %} +