From 51120ccf3160ca939c4b5479b83624b3885a49df Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 2 Mar 2021 15:58:33 -0500 Subject: [PATCH] Introduce generic object template --- netbox/templates/circuits/circuit.html | 59 +------- netbox/templates/circuits/provider.html | 57 +------- netbox/templates/dcim/cable.html | 49 ++----- netbox/templates/dcim/device/base.html | 138 ++++++++---------- netbox/templates/dcim/device_component.html | 49 ++----- netbox/templates/dcim/devicetype.html | 120 +++++++-------- netbox/templates/dcim/powerfeed.html | 63 ++------ netbox/templates/dcim/powerpanel.html | 61 +------- netbox/templates/dcim/rack.html | 104 +++++-------- netbox/templates/dcim/rackreservation.html | 61 ++------ netbox/templates/dcim/site.html | 68 ++------- netbox/templates/dcim/virtualchassis.html | 65 ++------- netbox/templates/extras/configcontext.html | 45 +----- netbox/templates/generic/object.html | 63 ++++++++ netbox/templates/ipam/aggregate.html | 61 ++------ .../templates/ipam/inc/toggle_available.html | 18 +-- netbox/templates/ipam/ipaddress.html | 61 +------- netbox/templates/ipam/prefix.html | 110 +++++--------- netbox/templates/ipam/routetarget.html | 55 +------ netbox/templates/ipam/service.html | 54 +++---- netbox/templates/ipam/vlan.html | 94 ++++-------- netbox/templates/ipam/vrf.html | 55 +------ netbox/templates/secrets/secret.html | 52 ++----- netbox/templates/tenancy/tenant.html | 61 +------- netbox/templates/virtualization/cluster.html | 59 +------- .../virtualization/virtualmachine.html | 94 +++++------- .../templates/virtualization/vminterface.html | 42 +----- 27 files changed, 494 insertions(+), 1324 deletions(-) create mode 100644 netbox/templates/generic/object.html diff --git a/netbox/templates/circuits/circuit.html b/netbox/templates/circuits/circuit.html index 47125da14..09feaae5e 100644 --- a/netbox/templates/circuits/circuit.html +++ b/netbox/templates/circuits/circuit.html @@ -1,60 +1,11 @@ -{% extends 'base.html' %} -{% load buttons %} -{% load custom_links %} +{% extends 'generic/object.html' %} {% load helpers %} {% load plugins %} -{% block title %}{{ object }}{% endblock %} - -{% block header %} -
-
- -
-
-
-
- - - - -
-
-
-
-
- {% plugin_buttons object %} - {% if perms.circuits.add_circuit %} - {% clone_button object %} - {% endif %} - {% if perms.circuits.change_circuit %} - {% edit_button object %} - {% endif %} - {% if perms.circuits.delete_circuit %} - {% delete_button object %} - {% endif %} -
-

{{ object }}

- {% include 'inc/created_updated.html' %} -
- {% custom_links object %} -
- +{% block breadcrumbs %} +
  • Circuits
  • +
  • {{ object.provider }}
  • +
  • {{ object.cid }}
  • {% endblock %} {% block content %} diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html index 7fa512ec6..bb467e622 100644 --- a/netbox/templates/circuits/provider.html +++ b/netbox/templates/circuits/provider.html @@ -1,60 +1,11 @@ -{% extends 'base.html' %} -{% load buttons %} +{% extends 'generic/object.html' %} {% load static %} -{% load custom_links %} {% load helpers %} {% load plugins %} -{% block title %}{{ object }}{% endblock %} - -{% block header %} -
    -
    - -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    - {% plugin_buttons object %} - {% if perms.circuits.add_provider %} - {% clone_button object %} - {% endif %} - {% if perms.circuits.change_provider %} - {% edit_button object %} - {% endif %} - {% if perms.circuits.delete_provider %} - {% delete_button object %} - {% endif %} -
    -

    {{ object }}

    - {% include 'inc/created_updated.html' %} -
    - {% custom_links object %} -
    - +{% block breadcrumbs %} +
  • Providers
  • +
  • {{ object }}
  • {% endblock %} {% block content %} diff --git a/netbox/templates/dcim/cable.html b/netbox/templates/dcim/cable.html index 3bc7869fe..a69bac6d6 100644 --- a/netbox/templates/dcim/cable.html +++ b/netbox/templates/dcim/cable.html @@ -1,42 +1,21 @@ -{% extends 'base.html' %} +{% extends 'generic/object.html' %} {% load buttons %} -{% load custom_links %} {% load helpers %} +{% load perms %} {% load plugins %} -{% block header %} -
    -
    - -
    -
    -
    - {% plugin_buttons object %} - {% if perms.dcim.change_cable %} - {% edit_button object %} - {% endif %} - {% if perms.dcim.delete_cable %} - {% delete_button object %} - {% endif %} -
    -

    {% block title %}Cable {{ object }}{% endblock %}

    - {% include 'inc/created_updated.html' %} -
    - {% custom_links object %} -
    - +{% block breadcrumbs %} +
  • Cables
  • +
  • {{ object }}
  • +{% endblock %} + +{% block buttons %} + {% if request.user|can_change:object %} + {% edit_button object %} + {% endif %} + {% if request.user|can_delete:object %} + {% delete_button object %} + {% endif %} {% endblock %} {% block content %} diff --git a/netbox/templates/dcim/device/base.html b/netbox/templates/dcim/device/base.html index 8f488b284..72a40134b 100644 --- a/netbox/templates/dcim/device/base.html +++ b/netbox/templates/dcim/device/base.html @@ -1,91 +1,69 @@ -{% extends 'base.html' %} +{% extends 'generic/object.html' %} {% load buttons %} {% load static %} {% load helpers %} {% load custom_links %} {% load plugins %} -{% block title %}{{ object }}{% endblock %} +{% block breadcrumbs %} +
  • Devices
  • +
  • {{ object.site }}
  • + {% if object.parent_bay %} +
  • {{ object.parent_bay.device }}
  • +
  • {{ object.parent_bay }}
  • + {% endif %} +
  • {{ object }}
  • +{% endblock %} -{% block header %} -
    -
    - -
    -
    -
    -
    - - - - -
    -
    -
    -
    -
    - {% plugin_buttons object %} - {% if perms.dcim.change_device %} -
    - - -
    - {% endif %} - {% if perms.dcim.add_device %} - {% clone_button object %} - {% endif %} - {% if perms.dcim.change_device %} - {% edit_button object %} - {% endif %} - {% if perms.dcim.delete_device %} - {% delete_button object %} - {% endif %} -
    -

    {{ object }}

    - {% include 'inc/created_updated.html' %} -
    - {% custom_links object %} +{% block buttons %} + {% if perms.dcim.change_device %} +
    + +
    + {% endif %} + {% if perms.dcim.add_device %} + {% clone_button object %} + {% endif %} + {% if perms.dcim.change_device %} + {% edit_button object %} + {% endif %} + {% if perms.dcim.delete_device %} + {% delete_button object %} + {% endif %} +{% endblock %} + +{% block tabs %}