From 805892f623365ecedd0384f60b7ac07057284880 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 17 May 2021 16:27:27 -0400 Subject: [PATCH] Template cleanup (#6421) * Clean up & comment base templates * Clean up login template & form * Use SVG file for NetBox logo * Simplify breadcrumbs * Merge changelog.html into home.html * Rename title_container block to header * Move breadcrumbs block to object.html * Attach names to endblock template tags * Reorganize root-level templates into base/ and inc/ * Remove obsolete reference to Bootstrap 3.4.1 --- netbox/templates/403.html | 2 +- netbox/templates/404.html | 2 +- netbox/templates/{ => base}/40x.html | 2 +- netbox/templates/{ => base}/base.html | 46 +++++-- netbox/templates/base/layout.html | 128 ++++++++++++++++++ netbox/templates/bottom.html | 16 --- netbox/templates/changelog.html | 47 ------- netbox/templates/dcim/cable_connect.html | 2 +- netbox/templates/dcim/cable_trace.html | 2 +- netbox/templates/dcim/connections_list.html | 4 +- .../templates/dcim/device_component_add.html | 2 +- netbox/templates/dcim/devicebay_populate.html | 2 +- .../dcim/devicetype_component_add.html | 2 +- .../dcim/inc/devicetype_component_table.html | 4 +- netbox/templates/dcim/interface.html | 4 +- .../templates/dcim/rack_elevation_list.html | 2 +- .../dcim/virtualchassis_add_member.html | 2 +- .../templates/dcim/virtualchassis_edit.html | 2 +- netbox/templates/exceptions/import_error.html | 2 +- .../exceptions/permission_error.html | 2 +- .../exceptions/programming_error.html | 2 +- netbox/templates/extras/object_changelog.html | 2 +- netbox/templates/extras/object_journal.html | 2 +- netbox/templates/extras/objectchange.html | 28 ++-- netbox/templates/extras/report.html | 14 +- netbox/templates/extras/report_list.html | 2 +- netbox/templates/extras/script.html | 15 +- netbox/templates/extras/script_list.html | 2 +- netbox/templates/extras/script_result.html | 2 +- netbox/templates/extras/tag.html | 2 +- netbox/templates/footer.html | 42 ------ netbox/templates/generic/object.html | 34 ++--- .../generic/object_bulk_add_component.html | 4 +- .../templates/generic/object_bulk_delete.html | 4 +- .../templates/generic/object_bulk_edit.html | 4 +- .../templates/generic/object_bulk_import.html | 4 +- .../templates/generic/object_bulk_remove.html | 4 +- .../templates/generic/object_bulk_rename.html | 4 +- netbox/templates/generic/object_delete.html | 6 +- netbox/templates/generic/object_edit.html | 10 +- netbox/templates/generic/object_import.html | 4 +- netbox/templates/generic/object_list.html | 8 +- netbox/templates/home.html | 126 +++++++++++------ netbox/templates/import_success.html | 6 +- netbox/templates/{ => inc}/messages.html | 0 netbox/templates/{ => inc}/panel_table.html | 0 .../templates/{ => inc}/profile_button.html | 0 .../templates/{ => inc}/responsive_table.html | 0 netbox/templates/ipam/aggregate.html | 2 +- netbox/templates/ipam/ipaddress.html | 4 +- netbox/templates/ipam/ipaddress_assign.html | 2 +- netbox/templates/ipam/prefix.html | 4 +- .../templates/ipam/prefix/ip_addresses.html | 2 +- netbox/templates/ipam/prefix/prefixes.html | 2 +- netbox/templates/ipam/routetarget.html | 4 +- netbox/templates/ipam/vlan.html | 2 +- netbox/templates/ipam/vlan/interfaces.html | 2 +- netbox/templates/ipam/vlan/vminterfaces.html | 2 +- netbox/templates/ipam/vrf.html | 4 +- netbox/templates/layout.html | 81 ----------- netbox/templates/login.html | 110 ++++++++------- netbox/templates/logo.html | 21 --- netbox/templates/rest_framework/api.html | 6 - netbox/templates/search.html | 6 +- netbox/templates/search_form.html | 9 -- netbox/templates/users/base.html | 2 +- .../utilities/confirmation_form.html | 2 +- netbox/templates/utilities/obj_table.html | 4 +- .../virtualization/cluster/devices.html | 2 +- .../cluster/virtual_machines.html | 2 +- .../virtualmachine_component_add.html | 2 +- .../templates/virtualization/vminterface.html | 4 +- netbox/users/forms.py | 7 +- 73 files changed, 426 insertions(+), 468 deletions(-) rename netbox/templates/{ => base}/40x.html (94%) rename netbox/templates/{ => base}/base.html (69%) create mode 100644 netbox/templates/base/layout.html delete mode 100644 netbox/templates/bottom.html delete mode 100644 netbox/templates/changelog.html delete mode 100644 netbox/templates/footer.html rename netbox/templates/{ => inc}/messages.html (100%) rename netbox/templates/{ => inc}/panel_table.html (100%) rename netbox/templates/{ => inc}/profile_button.html (100%) rename netbox/templates/{ => inc}/responsive_table.html (100%) delete mode 100644 netbox/templates/layout.html delete mode 100644 netbox/templates/logo.html delete mode 100644 netbox/templates/search_form.html diff --git a/netbox/templates/403.html b/netbox/templates/403.html index 844697aae..259206f21 100644 --- a/netbox/templates/403.html +++ b/netbox/templates/403.html @@ -1,4 +1,4 @@ -{% extends '40x.html' %} +{% extends 'base/40x.html' %} {% block title %}Access Denied{% endblock %} diff --git a/netbox/templates/404.html b/netbox/templates/404.html index eec438071..766d81732 100644 --- a/netbox/templates/404.html +++ b/netbox/templates/404.html @@ -1,4 +1,4 @@ -{% extends '40x.html' %} +{% extends 'base/40x.html' %} {% block title %}Page Not Found{% endblock %} diff --git a/netbox/templates/40x.html b/netbox/templates/base/40x.html similarity index 94% rename from netbox/templates/40x.html rename to netbox/templates/base/40x.html index b27a157cf..bcd8d1bc0 100644 --- a/netbox/templates/40x.html +++ b/netbox/templates/base/40x.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% block title %}{% endblock %} diff --git a/netbox/templates/base.html b/netbox/templates/base/base.html similarity index 69% rename from netbox/templates/base.html rename to netbox/templates/base/base.html index a2f1337ac..5c9f162c1 100644 --- a/netbox/templates/base.html +++ b/netbox/templates/base/base.html @@ -1,8 +1,20 @@ -{% load static %} {% load helpers %} +{# Base template for (almost) all NetBox pages #} +{% load static %} +{% load static %} +{% load helpers %} + + + + {# Page title #} {% block title %}Home{% endblock %} | NetBox + + {# Static resources #} - - - + + {# Javascript #} + + {# Additional content #} {% block head %}{% endblock %} - {% with color_mode=preferences|get_key:'ui.colormode' %} - - + + + {# Page layout #} {% block layout %}{% endblock %} + + {# Additional Javascript #} {% block javascript %}{% endblock %} - {% include './messages.html' %} + + {# User messages #} + {% include 'inc/messages.html' %} + + {# Data container #}
- {% block data %}{% endblock %} + {% block data %}{% endblock %}
+ - {% endwith %} diff --git a/netbox/templates/base/layout.html b/netbox/templates/base/layout.html new file mode 100644 index 000000000..e455201cc --- /dev/null +++ b/netbox/templates/base/layout.html @@ -0,0 +1,128 @@ +{# Base layout for the core NetBox UI w/navbar and page content #} +{% extends 'base/base.html' %} +{% load nav %} +{% load search_options %} +{% load static %} + +{% block layout %} +
+
+
+ + {# Sidebar #} + + + {# Top bar #} + + + {# Body #} +
+ + {# Page header #} + {% block header %} +
+ + {# Title #} +
+

{% block title %}{% endblock %}

+
+ + {# Controls #} + {% block controls %}{% endblock %} + +
+ {% endblock header %} + + {# Page content #} +
+ {% block tabs %}{% endblock %} + {% block content %}{% endblock %} +
+ + {# Page footer #} +
+
+
+
+ {% now 'Y-m-d H:i:s T' %} + {{ settings.HOSTNAME }} (v{{ settings.VERSION }}) +
+
+
+ +
+ +
+
+
+{% endblock layout %} diff --git a/netbox/templates/bottom.html b/netbox/templates/bottom.html deleted file mode 100644 index 5b5978e3a..000000000 --- a/netbox/templates/bottom.html +++ /dev/null @@ -1,16 +0,0 @@ - diff --git a/netbox/templates/changelog.html b/netbox/templates/changelog.html deleted file mode 100644 index 9f6aae834..000000000 --- a/netbox/templates/changelog.html +++ /dev/null @@ -1,47 +0,0 @@ -{% load helpers %} {% load get_status %} -{% if changelog and perms.extras.view_objectchange %} - - - - - - - - - - - - - {% for change in changelog %} - - - - - - - - - - {% endfor %} - -
UserActionTypeObjectTime
{{ change.user|default:change.user_name }}{{ change.get_action_display|bettertitle }}{{ change.changed_object_type.name|bettertitle }} - {% if change.changed_object.get_absolute_url %} - {{ change.changed_object }} - {% else %} {{ change.changed_object|default:change.object_repr }} {% endif %} - {{ change.time|date:'SHORT_DATETIME_FORMAT' }} - - - -
- -{% elif perms.extras.view_objectchange %} - - -{% else %} - -{% endif %} diff --git a/netbox/templates/dcim/cable_connect.html b/netbox/templates/dcim/cable_connect.html index 6877cfedc..bce3f3186 100644 --- a/netbox/templates/dcim/cable_connect.html +++ b/netbox/templates/dcim/cable_connect.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load static %} {% load helpers %} {% load form_helpers %} diff --git a/netbox/templates/dcim/cable_trace.html b/netbox/templates/dcim/cable_trace.html index e89d12ce9..098f790e1 100644 --- a/netbox/templates/dcim/cable_trace.html +++ b/netbox/templates/dcim/cable_trace.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% block header %} diff --git a/netbox/templates/dcim/connections_list.html b/netbox/templates/dcim/connections_list.html index 3b8665947..8505d9ec4 100644 --- a/netbox/templates/dcim/connections_list.html +++ b/netbox/templates/dcim/connections_list.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load buttons %} {% block title %}{{ title }}{% endblock %} @@ -10,7 +10,7 @@
- {% include 'responsive_table.html' %} + {% include 'inc/responsive_table.html' %}
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %} diff --git a/netbox/templates/dcim/device_component_add.html b/netbox/templates/dcim/device_component_add.html index e8b82f2c0..d643ee145 100644 --- a/netbox/templates/dcim/device_component_add.html +++ b/netbox/templates/dcim/device_component_add.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load form_helpers %} {% block title %}Create {{ component_type }}{% endblock %} diff --git a/netbox/templates/dcim/devicebay_populate.html b/netbox/templates/dcim/devicebay_populate.html index ffe2caf8b..a83b56474 100644 --- a/netbox/templates/dcim/devicebay_populate.html +++ b/netbox/templates/dcim/devicebay_populate.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load form_helpers %} {% render_errors form %} diff --git a/netbox/templates/dcim/devicetype_component_add.html b/netbox/templates/dcim/devicetype_component_add.html index 552dd8853..567b2b280 100644 --- a/netbox/templates/dcim/devicetype_component_add.html +++ b/netbox/templates/dcim/devicetype_component_add.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load form_helpers %} {% block title %}Add {{ component_type }} to {{ parent }}{% endblock %} diff --git a/netbox/templates/dcim/inc/devicetype_component_table.html b/netbox/templates/dcim/inc/devicetype_component_table.html index e61cb2996..dd79a668c 100644 --- a/netbox/templates/dcim/inc/devicetype_component_table.html +++ b/netbox/templates/dcim/inc/devicetype_component_table.html @@ -7,7 +7,7 @@ {{ title }}
- {% include 'responsive_table.html' %} + {% include 'inc/responsive_table.html' %}
{% endif %} diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index 54cfc2604..eb3f61672 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -291,12 +291,12 @@
- {% include 'panel_table.html' with table=vlan_table heading="VLANs" %} + {% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
- {% include 'panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %} + {% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
diff --git a/netbox/templates/dcim/rack_elevation_list.html b/netbox/templates/dcim/rack_elevation_list.html index 363b92779..7bd566e36 100644 --- a/netbox/templates/dcim/rack_elevation_list.html +++ b/netbox/templates/dcim/rack_elevation_list.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load static %} diff --git a/netbox/templates/dcim/virtualchassis_add_member.html b/netbox/templates/dcim/virtualchassis_add_member.html index b7818b47f..e8c0dac59 100644 --- a/netbox/templates/dcim/virtualchassis_add_member.html +++ b/netbox/templates/dcim/virtualchassis_add_member.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load form_helpers %} {% block title %}Add New Member to Virtual Chassis {{ virtual_chassis }}{% endblock %} diff --git a/netbox/templates/dcim/virtualchassis_edit.html b/netbox/templates/dcim/virtualchassis_edit.html index 195855620..d3e3f927f 100644 --- a/netbox/templates/dcim/virtualchassis_edit.html +++ b/netbox/templates/dcim/virtualchassis_edit.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} diff --git a/netbox/templates/exceptions/import_error.html b/netbox/templates/exceptions/import_error.html index 776014e6f..e8ee7ae2c 100644 --- a/netbox/templates/exceptions/import_error.html +++ b/netbox/templates/exceptions/import_error.html @@ -16,4 +16,4 @@ has recently been upgraded, check that the WSGI service (e.g. gunicorn or uWSGI) has been restarted. This ensures that the new code is running.

-{% endblock %} +{% endblock message %} diff --git a/netbox/templates/exceptions/permission_error.html b/netbox/templates/exceptions/permission_error.html index d6fb3d18c..dcff62bf9 100644 --- a/netbox/templates/exceptions/permission_error.html +++ b/netbox/templates/exceptions/permission_error.html @@ -9,4 +9,4 @@ media root is {{ settings.MEDIA_ROOT }}. Ensure that the user NetBox runs as has access to write files to all locations within this path.

-{% endblock %} +{% endblock message %} diff --git a/netbox/templates/exceptions/programming_error.html b/netbox/templates/exceptions/programming_error.html index d55c311cc..3b9e84567 100644 --- a/netbox/templates/exceptions/programming_error.html +++ b/netbox/templates/exceptions/programming_error.html @@ -14,4 +14,4 @@ can check this by connecting to the database using NetBox's credentials and issuing a query for SELECT VERSION().

-{% endblock %} +{% endblock message %} diff --git a/netbox/templates/extras/object_changelog.html b/netbox/templates/extras/object_changelog.html index 48df5161f..af65a9deb 100644 --- a/netbox/templates/extras/object_changelog.html +++ b/netbox/templates/extras/object_changelog.html @@ -3,7 +3,7 @@ {% block title %}{{ object }} - Change Log{% endblock %} {% block content %} - {% include 'panel_table.html' %} + {% include 'inc/panel_table.html' %} {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
Change log retention: {% if settings.CHANGELOG_RETENTION %}{{ settings.CHANGELOG_RETENTION }} days{% else %}Indefinite{% endif %} diff --git a/netbox/templates/extras/object_journal.html b/netbox/templates/extras/object_journal.html index bcb070b22..04cbfd3dd 100644 --- a/netbox/templates/extras/object_journal.html +++ b/netbox/templates/extras/object_journal.html @@ -26,7 +26,7 @@ {% endif %}
- {% include 'panel_table.html' %} + {% include 'inc/panel_table.html' %}
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %} {% endblock %} diff --git a/netbox/templates/extras/objectchange.html b/netbox/templates/extras/objectchange.html index 30664db9a..caffd80b0 100644 --- a/netbox/templates/extras/objectchange.html +++ b/netbox/templates/extras/objectchange.html @@ -1,22 +1,18 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% block title %}{{ object }}{% endblock %} -{% block breadcrumb_main %} - +{% block breadcrumbs %} + + {% if object.related_object.get_absolute_url %} + + {% elif object.changed_object.get_absolute_url %} + + {% elif object.changed_object %} + + {% endif %} + {% endblock %} {% block header %} @@ -159,7 +155,7 @@
- {% include 'panel_table.html' with table=related_changes_table heading='Related Changes' panel_class='default' %} + {% include 'inc/panel_table.html' with table=related_changes_table heading='Related Changes' panel_class='default' %} {% if related_changes_count > related_changes_table.rows|length %}
See All {{ related_changes_count|add:"1" }} Changes diff --git a/netbox/templates/extras/report.html b/netbox/templates/extras/report.html index 0d7698d76..e914e2776 100644 --- a/netbox/templates/extras/report.html +++ b/netbox/templates/extras/report.html @@ -1,16 +1,12 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% block title %}{{ report.name }}{% endblock %} -{% block breadcrumb_main %} - +{% block breadcrumbs %} + + + {% endblock %} {% block content %} diff --git a/netbox/templates/extras/report_list.html b/netbox/templates/extras/report_list.html index 8ce3fd931..c97e78c4e 100644 --- a/netbox/templates/extras/report_list.html +++ b/netbox/templates/extras/report_list.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% block title %}Reports{% endblock %} diff --git a/netbox/templates/extras/script.html b/netbox/templates/extras/script.html index 1078ba427..47a8c1f77 100644 --- a/netbox/templates/extras/script.html +++ b/netbox/templates/extras/script.html @@ -1,19 +1,14 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} {% load log_levels %} {% block title %}{{ script }}{% endblock %} -{% block breadcrumb_main %} - +{% block breadcrumbs %} + + + {% endblock %} {% block content %} diff --git a/netbox/templates/extras/script_list.html b/netbox/templates/extras/script_list.html index 290d7d64f..d271723d5 100644 --- a/netbox/templates/extras/script_list.html +++ b/netbox/templates/extras/script_list.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% block title %}Scripts{% endblock %} diff --git a/netbox/templates/extras/script_result.html b/netbox/templates/extras/script_result.html index 6d036251c..d8e25697d 100644 --- a/netbox/templates/extras/script_result.html +++ b/netbox/templates/extras/script_result.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} {% load log_levels %} diff --git a/netbox/templates/extras/tag.html b/netbox/templates/extras/tag.html index 7b50832fa..5caf81a9f 100644 --- a/netbox/templates/extras/tag.html +++ b/netbox/templates/extras/tag.html @@ -51,7 +51,7 @@
- {% include 'panel_table.html' with table=items_table heading='Tagged Objects' %} + {% include 'inc/panel_table.html' with table=items_table heading='Tagged Objects' %} {% include 'inc/paginator.html' with paginator=items_table.paginator page=items_table.page %}
diff --git a/netbox/templates/footer.html b/netbox/templates/footer.html deleted file mode 100644 index e0f78ddbe..000000000 --- a/netbox/templates/footer.html +++ /dev/null @@ -1,42 +0,0 @@ - diff --git a/netbox/templates/generic/object.html b/netbox/templates/generic/object.html index 27a324339..db40cc264 100644 --- a/netbox/templates/generic/object.html +++ b/netbox/templates/generic/object.html @@ -1,22 +1,22 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load buttons %} {% load custom_links %} {% load helpers %} {% load perms %} {% load plugins %} +{% block header %} + {# Breadcrumbs #} + + {{ block.super }} +{% endblock %} {% block title %}{{ object }}{% endblock %} -{% block breadcrumb_main %} - -{% endblock %} - {% block controls %}
@@ -34,15 +34,15 @@ {% endif %}
-{% endblock %} +{% endblock controls %} {% block tabs %} -{% endblock %} +{% endblock tabs %} {% block content %}

@@ -72,5 +72,5 @@ {{ object|meta:"app_label" }}.{{ object|meta:"model_name" }}:{{ object.pk }}

-{% endblock %} +{% endblock content %} {% block components %}{% endblock %} diff --git a/netbox/templates/generic/object_bulk_add_component.html b/netbox/templates/generic/object_bulk_add_component.html index ee8a69289..e9eadf92c 100644 --- a/netbox/templates/generic/object_bulk_add_component.html +++ b/netbox/templates/generic/object_bulk_add_component.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load form_helpers %} {% block title %}Add {{ model_name|title }}{% endblock %} @@ -37,4 +37,4 @@
-{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_bulk_delete.html b/netbox/templates/generic/object_bulk_delete.html index 4d3697db1..df41b4642 100644 --- a/netbox/templates/generic/object_bulk_delete.html +++ b/netbox/templates/generic/object_bulk_delete.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% block title %}Delete {{ table.rows|length }} {{ obj_type_plural|bettertitle }}?{% endblock %} @@ -39,4 +39,4 @@ -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_bulk_edit.html b/netbox/templates/generic/object_bulk_edit.html index a131ab78c..78309de7a 100644 --- a/netbox/templates/generic/object_bulk_edit.html +++ b/netbox/templates/generic/object_bulk_edit.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} @@ -42,4 +42,4 @@ -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_bulk_import.html b/netbox/templates/generic/object_bulk_import.html index 943162778..2fbd00058 100644 --- a/netbox/templates/generic/object_bulk_import.html +++ b/netbox/templates/generic/object_bulk_import.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} @@ -127,4 +127,4 @@ -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_bulk_remove.html b/netbox/templates/generic/object_bulk_remove.html index 383139765..cf18bf1cc 100644 --- a/netbox/templates/generic/object_bulk_remove.html +++ b/netbox/templates/generic/object_bulk_remove.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% block title %}Remove {{ table.rows|length }} {{ obj_type_plural|bettertitle }}?{% endblock %} @@ -37,4 +37,4 @@ -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_bulk_rename.html b/netbox/templates/generic/object_bulk_rename.html index 0e1923a46..78501825b 100644 --- a/netbox/templates/generic/object_bulk_rename.html +++ b/netbox/templates/generic/object_bulk_rename.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} @@ -47,4 +47,4 @@ -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_delete.html b/netbox/templates/generic/object_delete.html index fdfda0aac..cd6ec07ab 100644 --- a/netbox/templates/generic/object_delete.html +++ b/netbox/templates/generic/object_delete.html @@ -4,6 +4,6 @@ {% block title %}Delete {{ obj_type }}?{% endblock %} {% block message %} -

Are you sure you want to delete {{ obj_type }} {{ obj }}?

- {% block message_extra %}{% endblock %} -{% endblock %} +

Are you sure you want to delete {{ obj_type }} {{ obj }}?

+ {% block message_extra %}{% endblock %} +{% endblock message %} diff --git a/netbox/templates/generic/object_edit.html b/netbox/templates/generic/object_edit.html index f10cceb15..01a044fc6 100644 --- a/netbox/templates/generic/object_edit.html +++ b/netbox/templates/generic/object_edit.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} {% load form_helpers %} {% load helpers %} +{% extends 'base/layout.html' %} {% load form_helpers %} {% load helpers %} {% block title %}{% if obj.pk %}Editing {{ obj_type }} {{ obj }}{% else %}Add a new {{ obj_type }}{% endif %}{% endblock %} @@ -8,7 +8,7 @@ {% endif %} -{% endblock %} +{% endblock controls %} {% block content %}
@@ -47,7 +47,7 @@ {% block form_fields %}{% render_form form %}{% endblock %} {% endif %} - {% endblock %} + {% endblock form %}
@@ -66,11 +66,11 @@ Create {% endif %} - {% endblock %} + {% endblock buttons %}
{% if obj and settings.DOCS_ROOT %} {% include 'inc/modal.html' with name='docs' content=obj|get_docs %} {% endif %} -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_import.html b/netbox/templates/generic/object_import.html index 89c32c808..f8024b5ae 100644 --- a/netbox/templates/generic/object_import.html +++ b/netbox/templates/generic/object_import.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} @@ -22,4 +22,4 @@ -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index 13c4954f4..52d47b54e 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load buttons %} {% load helpers %} {% load render_table from django_tables2 %} @@ -21,7 +21,7 @@ {% endif %} -{% endblock %} +{% endblock controls %} {% block content %} {% if table.paginator.num_pages > 1 %} @@ -78,7 +78,7 @@
{% csrf_token %} - {% include table_template|default:'responsive_table.html' %} + {% include table_template|default:'inc/responsive_table.html' %}
{% block bulk_buttons %}{% endblock %} {% if bulk_edit_url and permissions.change %} @@ -111,4 +111,4 @@ {% endif %}
{% table_config_form table table_name="ObjectTable" %} -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/home.html b/netbox/templates/home.html index 4d7a11f99..1b45d5fd2 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -1,56 +1,100 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} +{% load get_status %} {% load helpers %} -{% block title_container %}{% endblock %} +{% block header %}{% endblock %} {% block title %}Home{% endblock %} {% block content %} -
-
- {% for section in stats %} -
-
-
{{ section.label }}
-
-
- {% for item in section.items %} - - -
-
-
-

Changelog

-
- {% include 'changelog.html' %} + {# Changelog #} +
+
+
+

Changelog

+
+ {% if changelog and perms.extras.view_objectchange %} + {# TODO: Replace this with a django-tables2 Table #} + + + + + + + + + + + + + {% for change in changelog %} + + + + + + + + + + {% endfor %} + +
UserActionTypeObjectTime
{{ change.user|default:change.user_name }}{{ change.get_action_display|bettertitle }}{{ change.changed_object_type.name|bettertitle }} + {% if change.changed_object.get_absolute_url %} + {{ change.changed_object }} + {% else %} {{ change.changed_object|default:change.object_repr }} {% endif %} + {{ change.time|date:'SHORT_DATETIME_FORMAT' }} + + + +
+ {% elif perms.extras.view_objectchange %} + + {% endif %} + +
-
-{% endblock %} +{% endblock content %} diff --git a/netbox/templates/import_success.html b/netbox/templates/import_success.html index a86a78c3f..6feb7dab5 100644 --- a/netbox/templates/import_success.html +++ b/netbox/templates/import_success.html @@ -1,9 +1,9 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% block title %}Import Completed{% endblock %} {% block content %} - {% include 'responsive_table.html' %} + {% include 'inc/responsive_table.html' %} {% if return_url %} View All {% endif %} @@ -11,4 +11,4 @@ Import More -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/messages.html b/netbox/templates/inc/messages.html similarity index 100% rename from netbox/templates/messages.html rename to netbox/templates/inc/messages.html diff --git a/netbox/templates/panel_table.html b/netbox/templates/inc/panel_table.html similarity index 100% rename from netbox/templates/panel_table.html rename to netbox/templates/inc/panel_table.html diff --git a/netbox/templates/profile_button.html b/netbox/templates/inc/profile_button.html similarity index 100% rename from netbox/templates/profile_button.html rename to netbox/templates/inc/profile_button.html diff --git a/netbox/templates/responsive_table.html b/netbox/templates/inc/responsive_table.html similarity index 100% rename from netbox/templates/responsive_table.html rename to netbox/templates/inc/responsive_table.html diff --git a/netbox/templates/ipam/aggregate.html b/netbox/templates/ipam/aggregate.html index 6ad1e3d15..609a450f0 100644 --- a/netbox/templates/ipam/aggregate.html +++ b/netbox/templates/ipam/aggregate.html @@ -77,7 +77,7 @@
- {% include 'utilities/obj_table.html' with table=prefix_table table_template='panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' %} + {% include 'utilities/obj_table.html' with table=prefix_table table_template='inc/panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' %}
{% endblock %} diff --git a/netbox/templates/ipam/ipaddress.html b/netbox/templates/ipam/ipaddress.html index dffffd1f1..ae31979d9 100644 --- a/netbox/templates/ipam/ipaddress.html +++ b/netbox/templates/ipam/ipaddress.html @@ -114,7 +114,7 @@
- {% include 'panel_table.html' with table=parent_prefixes_table heading='Parent Prefixes' %} + {% include 'inc/panel_table.html' with table=parent_prefixes_table heading='Parent Prefixes' %} {% if duplicate_ips_table.rows %} {# Custom version of panel_table.html #}
@@ -138,7 +138,7 @@
{% endif %}
- {% include 'utilities/obj_table.html' with table=related_ips_table table_template='panel_table.html' heading='Related IP Addresses' %} + {% include 'utilities/obj_table.html' with table=related_ips_table table_template='inc/panel_table.html' heading='Related IP Addresses' %}
{% plugin_right_page object %}
diff --git a/netbox/templates/ipam/ipaddress_assign.html b/netbox/templates/ipam/ipaddress_assign.html index c87d1ead1..48b04c8aa 100644 --- a/netbox/templates/ipam/ipaddress_assign.html +++ b/netbox/templates/ipam/ipaddress_assign.html @@ -34,7 +34,7 @@

Search Results

- {% include 'utilities/obj_table.html' with table_template='panel_table.html' %} + {% include 'utilities/obj_table.html' with table_template='inc/panel_table.html' %}
{% endif %} diff --git a/netbox/templates/ipam/prefix.html b/netbox/templates/ipam/prefix.html index 36675aa13..08270f760 100644 --- a/netbox/templates/ipam/prefix.html +++ b/netbox/templates/ipam/prefix.html @@ -117,9 +117,9 @@
{% if duplicate_prefix_table.rows %} - {% include 'panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' %} + {% include 'inc/panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' %} {% endif %} - {% include 'panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' %} + {% include 'inc/panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' %} {% plugin_right_page object %}
diff --git a/netbox/templates/ipam/prefix/ip_addresses.html b/netbox/templates/ipam/prefix/ip_addresses.html index 4d422b682..09c800b01 100644 --- a/netbox/templates/ipam/prefix/ip_addresses.html +++ b/netbox/templates/ipam/prefix/ip_addresses.html @@ -12,7 +12,7 @@ {% block content %}
- {% include 'utilities/obj_table.html' with table=ip_table table_template='panel_table.html' heading='IP Addresses' bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %} + {% include 'utilities/obj_table.html' with table=ip_table table_template='inc/panel_table.html' heading='IP Addresses' bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %}
{% endblock %} diff --git a/netbox/templates/ipam/prefix/prefixes.html b/netbox/templates/ipam/prefix/prefixes.html index a83b3ac12..b33288768 100644 --- a/netbox/templates/ipam/prefix/prefixes.html +++ b/netbox/templates/ipam/prefix/prefixes.html @@ -19,7 +19,7 @@ {% block content %}
- {% include 'utilities/obj_table.html' with table=prefix_table table_template='panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %} + {% include 'utilities/obj_table.html' with table=prefix_table table_template='inc/panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
{% endblock %} diff --git a/netbox/templates/ipam/routetarget.html b/netbox/templates/ipam/routetarget.html index c2c7fd7ed..c29bdc0bd 100644 --- a/netbox/templates/ipam/routetarget.html +++ b/netbox/templates/ipam/routetarget.html @@ -42,9 +42,9 @@
- {% include 'panel_table.html' with table=importing_vrfs_table heading="Importing VRFs" %} + {% include 'inc/panel_table.html' with table=importing_vrfs_table heading="Importing VRFs" %}
- {% include 'panel_table.html' with table=exporting_vrfs_table heading="Exporting VRFs" %} + {% include 'inc/panel_table.html' with table=exporting_vrfs_table heading="Exporting VRFs" %} {% plugin_right_page object %}
diff --git a/netbox/templates/ipam/vlan.html b/netbox/templates/ipam/vlan.html index 094310d9b..397a0a2a8 100644 --- a/netbox/templates/ipam/vlan.html +++ b/netbox/templates/ipam/vlan.html @@ -87,7 +87,7 @@ Prefixes
- {% include 'responsive_table.html' with table=prefix_table %} + {% include 'inc/responsive_table.html' with table=prefix_table %}
{% if perms.ipam.add_prefix %}
- {% include 'panel_table.html' with table=import_targets_table heading="Import Route Targets" %} - {% include 'panel_table.html' with table=export_targets_table heading="Export Route Targets" %} + {% include 'inc/panel_table.html' with table=import_targets_table heading="Import Route Targets" %} + {% include 'inc/panel_table.html' with table=export_targets_table heading="Export Route Targets" %} {% plugin_right_page object %}
diff --git a/netbox/templates/layout.html b/netbox/templates/layout.html deleted file mode 100644 index 66de47c08..000000000 --- a/netbox/templates/layout.html +++ /dev/null @@ -1,81 +0,0 @@ -{% extends 'base.html' %} -{% load search_options %} - -{% block head %}{% endblock %} - -{% block layout %} -
-
-
- - - -
- {% block title_container %} -
-
-

{% block title %}{% endblock %}

- {% block breadcrumb_main %}{% endblock %} -
- - {% block controls %}{% endblock %} -
- {% endblock %} -
- {% block tabs %}{% endblock %} - {% block content %}{% endblock %} -
-
-
-
-
- {% now 'Y-m-d H:i:s T' %} - {{ settings.HOSTNAME }} (v{{ settings.VERSION }}) -
-
-
-
-
-
-
-{% endblock %} -{% block javascript %}{% endblock %} -{% block data %}{% endblock %} diff --git a/netbox/templates/login.html b/netbox/templates/login.html index 164cb1176..5f56e7b9a 100644 --- a/netbox/templates/login.html +++ b/netbox/templates/login.html @@ -1,53 +1,58 @@ -{% extends 'base.html' %} {% load static %} {% block layout %} -
- {% if settings.BANNER_LOGIN %} - - {% endif %} -
-
-
+ {% endif %} + + {# Login form #} + + + {# Login form errors #} + {% if form.non_field_errors %} + + {% endif %} + + + {# Page footer #} +
+
-
-
-{% endblock %} +
+
+ +{% endblock layout %} diff --git a/netbox/templates/logo.html b/netbox/templates/logo.html deleted file mode 100644 index 41ad19b52..000000000 --- a/netbox/templates/logo.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/netbox/templates/rest_framework/api.html b/netbox/templates/rest_framework/api.html index 83a114c3a..76f43629b 100644 --- a/netbox/templates/rest_framework/api.html +++ b/netbox/templates/rest_framework/api.html @@ -1,10 +1,4 @@ {% extends 'rest_framework/base.html' %} -{% load static %} - -{% block bootstrap_theme %} - - -{% endblock %} {% block branding %} NetBox diff --git a/netbox/templates/search.html b/netbox/templates/search.html index b7637ba98..24cd0b3bd 100644 --- a/netbox/templates/search.html +++ b/netbox/templates/search.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} @@ -11,7 +11,7 @@
{% for obj_type in results %}

{{ obj_type.name|bettertitle }}

- {% include 'panel_table.html' with table=obj_type.table %} + {% include 'inc/panel_table.html' with table=obj_type.table %} {% if obj_type.table.page.has_next %} @@ -65,4 +65,4 @@
{% endif %} -{% endblock %} +{% endblock content %} diff --git a/netbox/templates/search_form.html b/netbox/templates/search_form.html deleted file mode 100644 index a4dcc79d3..000000000 --- a/netbox/templates/search_form.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
-
- - {{ search_form.obj_type }} - -
-
-
diff --git a/netbox/templates/users/base.html b/netbox/templates/users/base.html index d24681462..d362e637d 100644 --- a/netbox/templates/users/base.html +++ b/netbox/templates/users/base.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% block title %}{% endblock %} diff --git a/netbox/templates/utilities/confirmation_form.html b/netbox/templates/utilities/confirmation_form.html index e1e420bb0..32ba3345f 100644 --- a/netbox/templates/utilities/confirmation_form.html +++ b/netbox/templates/utilities/confirmation_form.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load form_helpers %} {% block content %} diff --git a/netbox/templates/utilities/obj_table.html b/netbox/templates/utilities/obj_table.html index 061fe7428..d87c09f90 100644 --- a/netbox/templates/utilities/obj_table.html +++ b/netbox/templates/utilities/obj_table.html @@ -27,7 +27,7 @@
{% endif %} - {% include table_template|default:'responsive_table.html' %} + {% include table_template|default:'inc/responsive_table.html' %}
{% block extra_actions %}{% endblock %} {% if bulk_edit_url and permissions.change %} @@ -43,7 +43,7 @@
{% else %} - {% include table_template|default:'responsive_table.html' %} + {% include table_template|default:'inc/responsive_table.html' %} {% endif %} {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
diff --git a/netbox/templates/virtualization/cluster/devices.html b/netbox/templates/virtualization/cluster/devices.html index 99f8d43df..658162243 100644 --- a/netbox/templates/virtualization/cluster/devices.html +++ b/netbox/templates/virtualization/cluster/devices.html @@ -11,7 +11,7 @@
{% csrf_token %}
- {% include 'responsive_table.html' with table=devices_table %} + {% include 'inc/responsive_table.html' with table=devices_table %}
{% if perms.virtualization.change_cluster %} diff --git a/netbox/templates/virtualization/virtualmachine_component_add.html b/netbox/templates/virtualization/virtualmachine_component_add.html index 2d64b919c..939acb1c4 100644 --- a/netbox/templates/virtualization/virtualmachine_component_add.html +++ b/netbox/templates/virtualization/virtualmachine_component_add.html @@ -1,4 +1,4 @@ -{% extends 'layout.html' %} +{% extends 'base/layout.html' %} {% load helpers %} {% load form_helpers %} diff --git a/netbox/templates/virtualization/vminterface.html b/netbox/templates/virtualization/vminterface.html index afa3164a6..5429aadd0 100644 --- a/netbox/templates/virtualization/vminterface.html +++ b/netbox/templates/virtualization/vminterface.html @@ -102,12 +102,12 @@
- {% include 'panel_table.html' with table=vlan_table heading="VLANs" %} + {% include 'inc/panel_table.html' with table=vlan_table heading="VLANs" %}
- {% include 'panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %} + {% include 'inc/panel_table.html' with table=child_interfaces_table heading="Child Interfaces" %}
diff --git a/netbox/users/forms.py b/netbox/users/forms.py index 495332d2c..8bd54cb66 100644 --- a/netbox/users/forms.py +++ b/netbox/users/forms.py @@ -6,12 +6,7 @@ from .models import Token class LoginForm(BootstrapMixin, AuthenticationForm): - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - - self.fields['username'].widget.attrs['placeholder'] = '' - self.fields['password'].widget.attrs['placeholder'] = '' + pass class PasswordChangeForm(BootstrapMixin, DjangoPasswordChangeForm):