diff --git a/netbox/netbox/views.py b/netbox/netbox/views.py index 8b4c91d2f..0e0b9e50c 100644 --- a/netbox/netbox/views.py +++ b/netbox/netbox/views.py @@ -199,7 +199,6 @@ class SearchView(View): }) - class APIRootView(APIView): _ignore_model_permissions = True exclude_from_schema = True diff --git a/netbox/project-static/css/base.css b/netbox/project-static/css/base.css index 11ea04b72..db37c3535 100644 --- a/netbox/project-static/css/base.css +++ b/netbox/project-static/css/base.css @@ -92,6 +92,9 @@ tfoot td { table.attr-table td:nth-child(1) { width: 25%; } +.table-headings th { + background-color: #f5f5f5; +} /* Paginator */ div.paginator { diff --git a/netbox/templates/panel_table.html b/netbox/templates/panel_table.html index 0d44d7ea9..cb807eeb6 100644 --- a/netbox/templates/panel_table.html +++ b/netbox/templates/panel_table.html @@ -20,6 +20,7 @@ {% endblock %} {% block pagination %} - {% include 'paginator.html' %} + {% if not hide_paginator %} + {% include 'paginator.html' %} + {% endif %} {% endblock pagination %} - diff --git a/netbox/templates/search.html b/netbox/templates/search.html index e0c60003a..afd4293ca 100644 --- a/netbox/templates/search.html +++ b/netbox/templates/search.html @@ -1,4 +1,5 @@ {% extends '_base.html' %} +{% load helpers %} {% load form_helpers %} {% block title %}Search{% endblock %} @@ -10,12 +11,12 @@
{% for obj_type in results %} -

{{ obj_type.name }}

- {% include 'table.html' with table=obj_type.table hide_paginator=True %} +

{{ obj_type.name|bettertitle }}

+ {% include 'panel_table.html' with table=obj_type.table hide_paginator=True %} {% if obj_type.table.page.has_next %} - - All {{ obj_type.table.page.paginator.count }} results + + See all {{ obj_type.table.page.paginator.count }} results {% endif %}
@@ -28,8 +29,8 @@
{% for obj_type in results %} - - {{ obj_type.name }} + + {{ obj_type.name|bettertitle }} {{ obj_type.table.page.paginator.count }} {% endfor %} @@ -41,7 +42,6 @@

No results found

{% endif %} {% else %} - {# Larger search form #}
diff --git a/netbox/utilities/tables.py b/netbox/utilities/tables.py index 279a7310b..1c5eab2a6 100644 --- a/netbox/utilities/tables.py +++ b/netbox/utilities/tables.py @@ -26,7 +26,7 @@ class SearchTable(tables.Table): """ class Meta: attrs = { - 'class': 'table table-hover', + 'class': 'table table-hover table-headings', } orderable = False diff --git a/netbox/utilities/templatetags/helpers.py b/netbox/utilities/templatetags/helpers.py index 164aa24b2..3c5770cb3 100644 --- a/netbox/utilities/templatetags/helpers.py +++ b/netbox/utilities/templatetags/helpers.py @@ -51,6 +51,13 @@ def startswith(value, arg): """ return str(value).startswith(arg) +@register.filter() +def bettertitle(value): + """ + Alternative to the builtin title(); uppercases words without replacing letters that are already uppercase. + """ + return ' '.join([w[0].upper() + w[1:] for w in value.split()]) + # # Tags