From f36041f738f9b64c0fa47d217235017913591206 Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Sat, 13 Mar 2021 09:34:25 +0000 Subject: [PATCH] Add paginator to top of lists. Reworked template grids to be more responsive on smaller screens. --- netbox/project-static/css/base.css | 7 +-- netbox/templates/circuits/provider.html | 2 +- netbox/templates/dcim/connections_list.html | 12 ++-- .../templates/dcim/rack_elevation_list.html | 10 ++-- netbox/templates/extras/object_changelog.html | 2 +- netbox/templates/extras/tag.html | 2 +- netbox/templates/generic/object_list.html | 57 +++++++++++-------- netbox/templates/inc/paginator.html | 34 +++++------ netbox/templates/utilities/obj_table.html | 2 +- 9 files changed, 67 insertions(+), 61 deletions(-) diff --git a/netbox/project-static/css/base.css b/netbox/project-static/css/base.css index efdca81be..4581f4ed2 100644 --- a/netbox/project-static/css/base.css +++ b/netbox/project-static/css/base.css @@ -33,11 +33,6 @@ footer p { #navbar_search { padding: 0 8px; } -.right-side-panel { - max-width: 400px; - min-width: 300px; - padding-right: 0; -} /* Hide the username in the navigation menu on displays less than 1400px wide */ @media (max-width: 1399px) { @@ -168,7 +163,7 @@ td.min-width { /* Paginator */ div.paginator { - margin-bottom: 20px; + margin-bottom: 1em; } div.paginator form { margin-bottom: 6px; diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html index 8778c3ac2..5c28b8c42 100644 --- a/netbox/templates/circuits/provider.html +++ b/netbox/templates/circuits/provider.html @@ -129,7 +129,7 @@ {% endif %} - {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page %} + {% include 'inc/paginator.html' with paginator=circuits_table.paginator page=circuits_table.page show_count=True %} {% plugin_right_page object %} diff --git a/netbox/templates/dcim/connections_list.html b/netbox/templates/dcim/connections_list.html index 80d76e7d1..449c579ab 100644 --- a/netbox/templates/dcim/connections_list.html +++ b/netbox/templates/dcim/connections_list.html @@ -6,13 +6,13 @@ {% export_button content_type %}

{% block title %}{{ title }}{% endblock %}

-
-
-
- {% include 'inc/search_panel.html' %} -
+
+
+ {% include 'inc/search_panel.html' %} +
+
{% include 'responsive_table.html' %} - {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %} + {% include 'inc/paginator.html' with paginator=table.paginator page=table.page show_count=True %}
{% endblock %} diff --git a/netbox/templates/dcim/rack_elevation_list.html b/netbox/templates/dcim/rack_elevation_list.html index a42610e35..92b76e16b 100644 --- a/netbox/templates/dcim/rack_elevation_list.html +++ b/netbox/templates/dcim/rack_elevation_list.html @@ -18,10 +18,10 @@

{% block title %}Rack Elevations{% endblock %}

-
-
- {% include 'inc/search_panel.html' %} -
+
+ {% include 'inc/search_panel.html' %} +
+
{% if page %}
{% for rack in page %} @@ -49,7 +49,7 @@ {% endfor %}

- {% include 'inc/paginator.html' %} + {% include 'inc/paginator.html' with show_count=True %} {% else %}

No racks found

{% endif %} diff --git a/netbox/templates/extras/object_changelog.html b/netbox/templates/extras/object_changelog.html index 64f76fe60..b579a6f84 100644 --- a/netbox/templates/extras/object_changelog.html +++ b/netbox/templates/extras/object_changelog.html @@ -4,7 +4,7 @@ {% block content %} {% include 'panel_table.html' %} - {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %} + {% include 'inc/paginator.html' with paginator=table.paginator page=table.page show_count=True %}
Change log retention: {% if settings.CHANGELOG_RETENTION %}{{ settings.CHANGELOG_RETENTION }} days{% else %}Indefinite{% endif %}
diff --git a/netbox/templates/extras/tag.html b/netbox/templates/extras/tag.html index 2ad7cf814..e19084e7f 100644 --- a/netbox/templates/extras/tag.html +++ b/netbox/templates/extras/tag.html @@ -92,7 +92,7 @@
{% include 'panel_table.html' with table=items_table heading='Tagged Objects' %} - {% include 'inc/paginator.html' with paginator=items_table.paginator page=items_table.page %} + {% include 'inc/paginator.html' with paginator=items_table.paginator page=items_table.page show_count=True %}
{% endblock %} diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index 738cbca49..386f77d8d 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -4,30 +4,38 @@ {% load static %} {% block content %} -
- {% block buttons %}{% endblock %} - {% if request.user.is_authenticated and table_config_form %} - - {% endif %} - {% if permissions.add and 'add' in action_buttons %} - {% add_button content_type.model_class|validated_viewname:"add" %} - {% endif %} - {% if permissions.add and 'import' in action_buttons %} - {% import_button content_type.model_class|validated_viewname:"import" %} - {% endif %} - {% if 'export' in action_buttons %} - {% export_button content_type %} - {% endif %} -
-

{% block title %}{{ content_type.model_class|meta:"verbose_name_plural"|bettertitle }}{% endblock %}

-
- {% if filter_form %} -
- {% include 'inc/search_panel.html' %} - {% block sidebar %}{% endblock %} -
+
+

{% block title %}{{ content_type.model_class|meta:"verbose_name_plural"|bettertitle }}{% endblock %}

+
+
+ {% block buttons %}{% endblock %} + {% if request.user.is_authenticated and table_config_form %} + {% endif %} + {% if permissions.add and 'add' in action_buttons %} + {% add_button content_type.model_class|validated_viewname:"add" %} + {% endif %} + {% if permissions.add and 'import' in action_buttons %} + {% import_button content_type.model_class|validated_viewname:"import" %} + {% endif %} + {% if 'export' in action_buttons %} + {% export_button content_type %} + {% endif %} +
+
+ {% include 'inc/paginator.html' with paginator=table.paginator page=table.page show_count=False%} +
+
+ +
+ {% if filter_form %} +
+ {% include 'inc/search_panel.html' %} + {% block sidebar %}{% endblock %} +
+ {% endif %} +
{% with bulk_edit_url=content_type.model_class|validated_viewname:"bulk_edit" bulk_delete_url=content_type.model_class|validated_viewname:"bulk_delete" %} {% if permissions.change or permissions.delete %}
@@ -58,7 +66,7 @@
{% endif %} {% include table_template|default:'responsive_table.html' %} -
+
{% block bulk_buttons %}{% endblock %} {% if bulk_edit_url and permissions.change %}
+ {% table_config_form table table_name="ObjectTable" %} {% endblock %} diff --git a/netbox/templates/inc/paginator.html b/netbox/templates/inc/paginator.html index 37c3b06df..158eded64 100644 --- a/netbox/templates/inc/paginator.html +++ b/netbox/templates/inc/paginator.html @@ -1,6 +1,6 @@ {% load helpers %} -
+
{% if paginator.num_pages > 1 %} {% endif %} - - {% for k, v_list in request.GET.lists %} - {% if k != 'per_page' %} - {% for v in v_list %} - - {% endfor %} - {% endif %} - {% endfor %} - + {% endfor %} + {% endif %} + {% endfor %} + per page - - {% if page %} -
- Showing {{ page.start_index }}-{{ page.end_index }} of {{ page.paginator.count }} -
+ per page + {% if page %} +
+ Showing {{ page.start_index }}-{{ page.end_index }} of {{ page.paginator.count }} +
+ {% endif %} + {% endif %}
diff --git a/netbox/templates/utilities/obj_table.html b/netbox/templates/utilities/obj_table.html index b1ea58668..261d6b6f6 100644 --- a/netbox/templates/utilities/obj_table.html +++ b/netbox/templates/utilities/obj_table.html @@ -45,5 +45,5 @@ {% else %} {% include table_template|default:'responsive_table.html' %} {% endif %} - {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %} +{% include 'inc/paginator.html' with paginator=table.paginator page=table.page show_count=True %}