From ccc108a2179606426b4e1004abc741ab20b3d9bd Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 26 Jan 2023 10:53:59 -0500 Subject: [PATCH] Closes #11598: Add buttons to easily switch between rack list and elevations views --- docs/release-notes/version-3.4.md | 1 + netbox/dcim/views.py | 1 + .../templates/dcim/rack_elevation_list.html | 51 ++++++++++--------- netbox/templates/dcim/rack_list.html | 9 ++++ netbox/templates/generic/object_list.html | 7 ++- 5 files changed, 41 insertions(+), 28 deletions(-) create mode 100644 netbox/templates/dcim/rack_list.html diff --git a/docs/release-notes/version-3.4.md b/docs/release-notes/version-3.4.md index d4f238b3c..4c9992f20 100644 --- a/docs/release-notes/version-3.4.md +++ b/docs/release-notes/version-3.4.md @@ -7,6 +7,7 @@ * [#10762](https://github.com/netbox-community/netbox/issues/10762) - Permit selection custom fields to have only one choice * [#11554](https://github.com/netbox-community/netbox/issues/11554) - Add module types count to manufacturers list * [#11585](https://github.com/netbox-community/netbox/issues/11585) - Add IP address filters for services +* [#11598](https://github.com/netbox-community/netbox/issues/11598) - Add buttons to easily switch between rack list and elevations views ### Bug Fixes diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 80b369b6d..9b49e799c 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -642,6 +642,7 @@ class RackListView(generic.ObjectListView): filterset = filtersets.RackFilterSet filterset_form = forms.RackFilterForm table = tables.RackTable + template_name = 'dcim/rack_list.html' class RackElevationListView(generic.ObjectListView): diff --git a/netbox/templates/dcim/rack_elevation_list.html b/netbox/templates/dcim/rack_elevation_list.html index c9d9a248a..bd02c9f74 100644 --- a/netbox/templates/dcim/rack_elevation_list.html +++ b/netbox/templates/dcim/rack_elevation_list.html @@ -5,31 +5,34 @@ {% block title %}Rack Elevations{% endblock %} {% block controls %} -
-
-
- -
-
- Front - Rear -
- -
+
+
+ + View List + +
+ +
+
+ Front + Rear +
+
+
{% endblock %} {% block content-wrapper %} diff --git a/netbox/templates/dcim/rack_list.html b/netbox/templates/dcim/rack_list.html new file mode 100644 index 000000000..897625af6 --- /dev/null +++ b/netbox/templates/dcim/rack_list.html @@ -0,0 +1,9 @@ +{% extends 'generic/object_list.html' %} +{% load helpers %} +{% load static %} + +{% block extra_controls %} + + View Elevations + +{% endblock %} \ No newline at end of file diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index 8b3e317c0..e269e9da6 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -26,16 +26,15 @@ Context:
{% plugin_list_buttons model %} - {% block extra_controls %}{% endblock %} {% if 'add' in actions %} - {% add_button model %} + {% add_button model %} {% endif %} {% if 'import' in actions %} - {% import_button model %} + {% import_button model %} {% endif %} {% if 'export' in actions %} - {% export_button model %} + {% export_button model %} {% endif %}