Просмотр исходного кода

Moved object header templates into object base templates

Jeremy Stretch 7 лет назад
Родитель
Сommit
21c4085c51

+ 4 - 0
netbox/dcim/views.py

@@ -945,6 +945,7 @@ class DeviceInventoryView(View):
         return render(request, 'dcim/device_inventory.html', {
             'device': device,
             'inventory_items': inventory_items,
+            'active_tab': 'inventory',
         })
 
 
@@ -957,6 +958,7 @@ class DeviceStatusView(PermissionRequiredMixin, View):
 
         return render(request, 'dcim/device_status.html', {
             'device': device,
+            'active_tab': 'status',
         })
 
 
@@ -975,6 +977,7 @@ class DeviceLLDPNeighborsView(PermissionRequiredMixin, View):
         return render(request, 'dcim/device_lldp_neighbors.html', {
             'device': device,
             'interfaces': interfaces,
+            'active_tab': 'lldp-neighbors',
         })
 
 
@@ -987,6 +990,7 @@ class DeviceConfigView(PermissionRequiredMixin, View):
 
         return render(request, 'dcim/device_config.html', {
             'device': device,
+            'active_tab': 'config',
         })
 
 

+ 3 - 11
netbox/ipam/views.py

@@ -522,6 +522,7 @@ class PrefixPrefixesView(View):
             'prefix_table': prefix_table,
             'permissions': permissions,
             'bulk_querystring': 'vrf_id={}&within={}'.format(prefix.vrf.pk if prefix.vrf else '0', prefix.prefix),
+            'active_tab': 'prefixes',
         })
 
 
@@ -560,6 +561,7 @@ class PrefixIPAddressesView(View):
             'ip_table': ip_table,
             'permissions': permissions,
             'bulk_querystring': 'vrf_id={}&parent={}'.format(prefix.vrf.pk if prefix.vrf else '0', prefix.prefix),
+            'active_tab': 'ip-addresses',
         })
 
 
@@ -859,8 +861,6 @@ class VLANMembersView(View):
         members = vlan.get_members().select_related('device', 'virtual_machine')
 
         members_table = tables.VLANMemberTable(members)
-        # if request.user.has_perm('dcim.change_interface'):
-        #     members_table.columns.show('pk')
 
         paginate = {
             'klass': EnhancedPaginator,
@@ -868,18 +868,10 @@ class VLANMembersView(View):
         }
         RequestConfig(request, paginate).configure(members_table)
 
-        # Compile permissions list for rendering the object table
-        # permissions = {
-        #     'add': request.user.has_perm('ipam.add_ipaddress'),
-        #     'change': request.user.has_perm('ipam.change_ipaddress'),
-        #     'delete': request.user.has_perm('ipam.delete_ipaddress'),
-        # }
-
         return render(request, 'ipam/vlan_members.html', {
             'vlan': vlan,
             'members_table': members_table,
-            # 'permissions': permissions,
-            # 'bulk_querystring': 'vrf_id={}&parent={}'.format(prefix.vrf.pk if prefix.vrf else '0', prefix.prefix),
+            'active_tab': 'members',
         })
 
 

+ 1 - 0
netbox/templates/_base.html

@@ -34,6 +34,7 @@
                 {{ message }}
             </div>
         {% endfor %}
+        {% block header %}{% endblock %}
         {% block content %}{% endblock %}
         <div class="push"></div>
          {% if settings.BANNER_BOTTOM %}

+ 621 - 556
netbox/templates/dcim/device.html

@@ -2,631 +2,696 @@
 {% load static from staticfiles %}
 {% load helpers %}
 
-{% block title %}{{ device }}{% endblock %}
+{% block header %}
+    <div class="row">
+        <div class="col-sm-8 col-md-9">
+        <ol class="breadcrumb">
+            <li><a href="{% url 'dcim:site' slug=device.site.slug %}">{{ device.site }}</a></li>
+            {% if device.rack %}
+                <li><a href="{% url 'dcim:rack_list' %}?site={{ device.site.slug }}">Racks</a></li>
+                <li><a href="{% url 'dcim:rack' pk=device.rack.pk %}">{{ device.rack }}</a></li>
+            {% endif %}
+            {% if device.parent_bay %}
+                <li><a href="{% url 'dcim:device' pk=device.parent_bay.device.pk %}">{{ device.parent_bay.device }}</a></li>
+                <li>{{ device.parent_bay }}</li>
+            {% endif %}
+            <li>{{ device }}</li>
+        </ol>
+        </div>
+        <div class="col-sm-4 col-md-3">
+            <form action="{% url 'dcim:device_list' %}" method="get">
+                <div class="input-group">
+                    <input type="text" name="q" class="form-control" placeholder="Search devices" />
+                    <span class="input-group-btn">
+                        <button type="submit" class="btn btn-primary">
+                            <span class="fa fa-search" aria-hidden="true"></span>
+                        </button>
+                    </span>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="pull-right">
+        {% if perms.dcim.change_device %}
+            <a href="{% url 'dcim:device_edit' pk=device.pk %}" class="btn btn-warning">
+                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
+                Edit this device
+            </a>
+        {% endif %}
+        {% if perms.dcim.delete_device %}
+            <a href="{% url 'dcim:device_delete' pk=device.pk %}" class="btn btn-danger">
+                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
+                Delete this device
+            </a>
+        {% endif %}
+    </div>
+    <h1>{% block title %}{{ device }}{% endblock %}</h1>
+    {% include 'inc/created_updated.html' with obj=device %}
+    <ul class="nav nav-tabs" style="margin-bottom: 20px">
+        <li role="presentation"{% if not active_tab %} class="active"{% endif %}>
+            <a href="{% url 'dcim:device' pk=device.pk %}">Info</a>
+        </li>
+        <li role="presentation"{% if active_tab == 'inventory' %} class="active"{% endif %}>
+            <a href="{% url 'dcim:device_inventory' pk=device.pk %}">Inventory</a>
+        </li>
+        {% if perms.dcim.napalm_read %}
+            {% if device.status != 1 %}
+                {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %}
+            {% elif not device.platform %}
+                {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %}
+            {% elif not device.platform.napalm_driver %}
+                {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No NAPALM driver assigned for this platform' %}
+            {% elif not device.primary_ip %}
+                {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No primary IP address assigned to this device' %}
+            {% else %}
+                {% include 'dcim/inc/device_napalm_tabs.html' %}
+            {% endif %}
+        {% endif %}
+    </ul>
+{% endblock %}
 
 {% block content %}
-{% include 'dcim/inc/device_header.html' with active_tab='info' %}
-<div class="row">
-	<div class="col-md-6">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Device</strong>
-            </div>
-            <table class="table table-hover panel-body attr-table">
-                <tr>
-                    <td>Site</td>
-                    <td>
-                        {% if device.site.region %}
-                            <a href="{{ device.site.region.get_absolute_url }}">{{ device.site.region }}</a>
-                            <i class="fa fa-angle-right"></i>
-                        {% endif %}
-                        <a href="{% url 'dcim:site' slug=device.site.slug %}">{{ device.site }}</a>
-                    </td>
-                </tr>
-                <tr>
-                    <td>Rack</td>
-                    <td>
-                        {% if device.rack %}
-                            {% if device.rack.group %}
-                                <a href="{{ device.rack.group.get_absolute_url }}">{{ device.rack.group }}</a>
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Device</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Site</td>
+                        <td>
+                            {% if device.site.region %}
+                                <a href="{{ device.site.region.get_absolute_url }}">{{ device.site.region }}</a>
                                 <i class="fa fa-angle-right"></i>
                             {% endif %}
-                            <a href="{% url 'dcim:rack' pk=device.rack.pk %}">{{ device.rack }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Position</td>
-                    <td>
-                        {% if device.parent_bay %}
-                            {% with device.parent_bay.device as parent %}
-                                <a href="{{ parent.get_absolute_url }}">{{ parent }}</a> <i class="fa fa-angle-right"></i> {{ device.parent_bay }}
-                                {% if parent.position %}
-                                    (U{{ parent.position }} / {{ parent.get_face_display }})
+                            <a href="{% url 'dcim:site' slug=device.site.slug %}">{{ device.site }}</a>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Rack</td>
+                        <td>
+                            {% if device.rack %}
+                                {% if device.rack.group %}
+                                    <a href="{{ device.rack.group.get_absolute_url }}">{{ device.rack.group }}</a>
+                                    <i class="fa fa-angle-right"></i>
                                 {% endif %}
-                            {% endwith %}
-                        {% elif device.rack and device.position %}
-                            <span>U{{ device.position }} / {{ device.get_face_display }}</span>
-                        {% elif device.rack and device.device_type.u_height %}
-                            <span class="label label-warning">Not racked</span>
-                        {% else %}
-                            <span class="text-muted">N/A</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Tenant</td>
-                    <td>
-                        {% if device.tenant %}
-                            {% if device.tenant.group %}
-                                <a href="{{ device.tenant.group.get_absolute_url }}">{{ device.tenant.group }}</a>
-                                <i class="fa fa-angle-right"></i>
+                                <a href="{% url 'dcim:rack' pk=device.rack.pk %}">{{ device.rack }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
                             {% endif %}
-                            <a href="{{ device.tenant.get_absolute_url }}">{{ device.tenant }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Device Type</td>
-                    <td>
-                        <span><a href="{% url 'dcim:devicetype' pk=device.device_type.pk %}">{{ device.device_type.full_name }}</a> ({{ device.device_type.u_height }}U)</span>
-                    </td>
-                </tr>
-                <tr>
-                    <td>Serial Number</td>
-                    <td>
-                        {% if device.serial %}
-                            <span>{{ device.serial }}</span>
-                        {% else %}
-                            <span class="text-muted">N/A</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Position</td>
+                        <td>
+                            {% if device.parent_bay %}
+                                {% with device.parent_bay.device as parent %}
+                                    <a href="{{ parent.get_absolute_url }}">{{ parent }}</a> <i class="fa fa-angle-right"></i> {{ device.parent_bay }}
+                                    {% if parent.position %}
+                                        (U{{ parent.position }} / {{ parent.get_face_display }})
+                                    {% endif %}
+                                {% endwith %}
+                            {% elif device.rack and device.position %}
+                                <span>U{{ device.position }} / {{ device.get_face_display }}</span>
+                            {% elif device.rack and device.device_type.u_height %}
+                                <span class="label label-warning">Not racked</span>
+                            {% else %}
+                                <span class="text-muted">N/A</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Tenant</td>
+                        <td>
+                            {% if device.tenant %}
+                                {% if device.tenant.group %}
+                                    <a href="{{ device.tenant.group.get_absolute_url }}">{{ device.tenant.group }}</a>
+                                    <i class="fa fa-angle-right"></i>
+                                {% endif %}
+                                <a href="{{ device.tenant.get_absolute_url }}">{{ device.tenant }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Device Type</td>
+                        <td>
+                            <span><a href="{% url 'dcim:devicetype' pk=device.device_type.pk %}">{{ device.device_type.full_name }}</a> ({{ device.device_type.u_height }}U)</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Serial Number</td>
+                        <td>
+                            {% if device.serial %}
+                                <span>{{ device.serial }}</span>
+                            {% else %}
+                                <span class="text-muted">N/A</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Asset Tag</td>
+                        <td>
+                            {% if device.asset_tag %}
+                                <span>{{ device.asset_tag }}</span>
+                            {% else %}
+                                <span class="text-muted">N/A</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Tags</td>
+                        <td>
+                            {% for tag in device.tags.all %}
+                                {% tag 'dcim:device_list' tag %}
+                            {% empty %}
+                                <span class="text-muted">N/A</span>
+                            {% endfor %}
+                        </td>
+                    </tr>
+                </table>
+            </div>
+            {% if vc_members %}
+                <div class="panel panel-default">
+                    <div class="panel-heading">
+                        <strong>Virtual Chassis</strong>
+                    </div>
+                    <table class="table table-hover panel-body attr-table">
+                        <tr>
+                            <th>Device</th>
+                            <th>Position</th>
+                            <th>Master</th>
+                            <th>Priority</th>
+                        </tr>
+                        {% for vc_member in vc_members %}
+                            <tr{% if vc_member == device %} class="info"{% endif %}>
+                                <td>
+                                    <a href="{{ vc_member.get_absolute_url }}">{{ vc_member }}</a>
+                                </td>
+                                <td><span class="badge badge-default">{{ vc_member.vc_position }}</span></td>
+                                <td>{% if device.virtual_chassis.master == vc_member %}<i class="fa fa-check"></i>{% endif %}</td>
+                                <td>{{ vc_member.vc_priority|default:"" }}</td>
+                            </tr>
+                        {% endfor %}
+                    </table>
+                    <div class="panel-footer text-right">
+                        {% if perms.dcim.change_virtualchassis %}
+                            <a href="{% url 'dcim:virtualchassis_add_member' pk=device.virtual_chassis.pk %}?site={{ device.site.pk }}&rack={{ device.rack.pk }}&return_url={{ device.get_absolute_url }}" class="btn btn-primary btn-xs">
+                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add Member
+                            </a>
+                            <a href="{% url 'dcim:virtualchassis_edit' pk=device.virtual_chassis.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
+                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit Virtual Chassis
+                            </a>
                         {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Asset Tag</td>
-                    <td>
-                        {% if device.asset_tag %}
-                            <span>{{ device.asset_tag }}</span>
-                        {% else %}
-                            <span class="text-muted">N/A</span>
+                        {% if perms.dcim.delete_virtualchassis %}
+                            <a href="{% url 'dcim:virtualchassis_delete' pk=device.virtual_chassis.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete Virtual Chassis
+                            </a>
                         {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Tags</td>
-                    <td>
-                        {% for tag in device.tags.all %}
-                            {% tag 'dcim:device_list' tag %}
-                        {% empty %}
-                            <span class="text-muted">N/A</span>
-                        {% endfor %}
-                    </td>
-                </tr>
-            </table>
-        </div>
-        {% if vc_members %}
+                    </div>
+                </div>
+            {% endif %}
             <div class="panel panel-default">
                 <div class="panel-heading">
-                    <strong>Virtual Chassis</strong>
+                    <strong>Management</strong>
                 </div>
                 <table class="table table-hover panel-body attr-table">
                     <tr>
-                        <th>Device</th>
-                        <th>Position</th>
-                        <th>Master</th>
-                        <th>Priority</th>
+                        <td>Role</td>
+                        <td>
+                            <a href="{{ device.device_role.get_absolute_url }}">{{ device.device_role }}</a>
+                        </td>
                     </tr>
-                    {% for vc_member in vc_members %}
-                        <tr{% if vc_member == device %} class="info"{% endif %}>
-                            <td>
-                                <a href="{{ vc_member.get_absolute_url }}">{{ vc_member }}</a>
-                            </td>
-                            <td><span class="badge badge-default">{{ vc_member.vc_position }}</span></td>
-                            <td>{% if device.virtual_chassis.master == vc_member %}<i class="fa fa-check"></i>{% endif %}</td>
-                            <td>{{ vc_member.vc_priority|default:"" }}</td>
-                        </tr>
-                    {% endfor %}
-                </table>
-                <div class="panel-footer text-right">
-                    {% if perms.dcim.change_virtualchassis %}
-                        <a href="{% url 'dcim:virtualchassis_add_member' pk=device.virtual_chassis.pk %}?site={{ device.site.pk }}&rack={{ device.rack.pk }}&return_url={{ device.get_absolute_url }}" class="btn btn-primary btn-xs">
-                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add Member
-                        </a>
-                        <a href="{% url 'dcim:virtualchassis_edit' pk=device.virtual_chassis.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
-                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit Virtual Chassis
-                        </a>
-                    {% endif %}
-                    {% if perms.dcim.delete_virtualchassis %}
-                        <a href="{% url 'dcim:virtualchassis_delete' pk=device.virtual_chassis.pk %}?return_url={{ device.get_absolute_url }}" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete Virtual Chassis
-                        </a>
-                    {% endif %}
-                </div>
-            </div>
-        {% endif %}
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Management</strong>
-            </div>
-            <table class="table table-hover panel-body attr-table">
-                <tr>
-                    <td>Role</td>
-                    <td>
-                        <a href="{{ device.device_role.get_absolute_url }}">{{ device.device_role }}</a>
-                    </td>
-                </tr>
-                <tr>
-                    <td>Platform</td>
-                    <td>
-                        {% if device.platform %}
-                            <span>{{ device.platform }}</span>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Status</td>
-                    <td>
-                        <span class="label label-{{ device.get_status_class }}">{{ device.get_status_display }}</span>
-                    </td>
-                </tr>
-                <tr>
-                    <td>Primary IPv4</td>
-                    <td>
-                        {% if device.primary_ip4 %}
-                            <a href="{% url 'ipam:ipaddress' pk=device.primary_ip4.pk %}">{{ device.primary_ip4.address.ip }}</a>
-                            {% if device.primary_ip4.nat_inside %}
-                                <span>(NAT for {{ device.primary_ip4.nat_inside.address.ip }})</span>
-                            {% elif device.primary_ip4.nat_outside %}
-                                <span>(NAT: {{ device.primary_ip4.nat_outside.address.ip }})</span>
+                    <tr>
+                        <td>Platform</td>
+                        <td>
+                            {% if device.platform %}
+                                <span>{{ device.platform }}</span>
+                            {% else %}
+                                <span class="text-muted">None</span>
                             {% endif %}
-                        {% else %}
-                            <span class="text-muted">N/A</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Primary IPv6</td>
-                    <td>
-                        {% if device.primary_ip6 %}
-                            <a href="{% url 'ipam:ipaddress' pk=device.primary_ip6.pk %}">{{ device.primary_ip6.address.ip }}</a>
-                            {% if device.primary_ip6.nat_inside %}
-                                <span>(NAT for {{ device.primary_ip6.nat_inside.address.ip }})</span>
-                            {% elif device.primary_ip6.nat_outside %}
-                                <span>(NAT: {{ device.primary_ip6.nat_outside.address.ip }})</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Status</td>
+                        <td>
+                            <span class="label label-{{ device.get_status_class }}">{{ device.get_status_display }}</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Primary IPv4</td>
+                        <td>
+                            {% if device.primary_ip4 %}
+                                <a href="{% url 'ipam:ipaddress' pk=device.primary_ip4.pk %}">{{ device.primary_ip4.address.ip }}</a>
+                                {% if device.primary_ip4.nat_inside %}
+                                    <span>(NAT for {{ device.primary_ip4.nat_inside.address.ip }})</span>
+                                {% elif device.primary_ip4.nat_outside %}
+                                    <span>(NAT: {{ device.primary_ip4.nat_outside.address.ip }})</span>
+                                {% endif %}
+                            {% else %}
+                                <span class="text-muted">N/A</span>
                             {% endif %}
-                        {% else %}
-                            <span class="text-muted">N/A</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                {% if device.cluster %}
+                        </td>
+                    </tr>
                     <tr>
-                        <td>Cluster</td>
+                        <td>Primary IPv6</td>
                         <td>
-                            {% if device.cluster.group %}
-                                <a href="{{ device.cluster.group.get_absolute_url }}">{{ device.cluster.group }}</a>
-                                <i class="fa fa-angle-right"></i>
+                            {% if device.primary_ip6 %}
+                                <a href="{% url 'ipam:ipaddress' pk=device.primary_ip6.pk %}">{{ device.primary_ip6.address.ip }}</a>
+                                {% if device.primary_ip6.nat_inside %}
+                                    <span>(NAT for {{ device.primary_ip6.nat_inside.address.ip }})</span>
+                                {% elif device.primary_ip6.nat_outside %}
+                                    <span>(NAT: {{ device.primary_ip6.nat_outside.address.ip }})</span>
+                                {% endif %}
+                            {% else %}
+                                <span class="text-muted">N/A</span>
                             {% endif %}
-                            <a href="{{ device.cluster.get_absolute_url }}">{{ device.cluster }}</a>
                         </td>
                     </tr>
-                {% endif %}
-            </table>
-        </div>
-        {% with device.get_custom_fields as custom_fields %}
-            {% include 'inc/custom_fields_panel.html' %}
-        {% endwith %}
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Comments</strong>
-            </div>
-            <div class="panel-body">
-                {% if device.comments %}
-                    {{ device.comments|gfm }}
-                {% else %}
-                    <span class="text-muted">None</span>
-                {% endif %}
-            </div>
-        </div>
-    </div>
-    <div class="col-md-6">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Console / Power</strong>
-            </div>
-            <table class="table table-hover panel-body component-list">
-                {% for cp in console_ports %}
-                    {% include 'dcim/inc/consoleport.html' %}
-                {% empty %}
-                    {% if device.device_type.console_port_templates.exists %}
+                    {% if device.cluster %}
                         <tr>
-                            <td colspan="6" class="alert-warning">
-                                <i class="fa fa-fw fa-warning"></i> No console ports defined
-                                {% if perms.dcim.add_consoleport %}
-                                    <a href="{% url 'dcim:consoleport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
+                            <td>Cluster</td>
+                            <td>
+                                {% if device.cluster.group %}
+                                    <a href="{{ device.cluster.group.get_absolute_url }}">{{ device.cluster.group }}</a>
+                                    <i class="fa fa-angle-right"></i>
                                 {% endif %}
+                                <a href="{{ device.cluster.get_absolute_url }}">{{ device.cluster }}</a>
                             </td>
                         </tr>
                     {% endif %}
-                {% endfor %}
-                {% for pp in power_ports %}
-                    {% include 'dcim/inc/powerport.html' %}
-                {% empty %}
-                    {% if device.device_type.power_port_templates.exists %}
-                        <tr>
-                            <td colspan="6" class="alert-warning">
-                                <i class="fa fa-fw fa-warning"></i> No power ports defined
-                                {% if perms.dcim.add_powerport %}
-                                    <a href="{% url 'dcim:powerport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
-                                {% endif %}
-                            </td>
-                        </tr>
+                </table>
+            </div>
+            {% with device.get_custom_fields as custom_fields %}
+                {% include 'inc/custom_fields_panel.html' %}
+            {% endwith %}
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Comments</strong>
+                </div>
+                <div class="panel-body">
+                    {% if device.comments %}
+                        {{ device.comments|gfm }}
+                    {% else %}
+                        <span class="text-muted">None</span>
                     {% endif %}
-                {% endfor %}
-            </table>
-            {% if perms.dcim.add_interface or perms.dcim.add_consoleport or perms.dcim.add_powerport %}
-                <div class="panel-footer text-right">
-                    {% if perms.dcim.add_consoleport %}
-                        <a href="{% url 'dcim:consoleport_add' pk=device.pk %}" class="btn btn-xs btn-primary">
-                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add console port
-                        </a>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Console / Power</strong>
+                </div>
+                <table class="table table-hover panel-body component-list">
+                    {% for cp in console_ports %}
+                        {% include 'dcim/inc/consoleport.html' %}
+                    {% empty %}
+                        {% if device.device_type.console_port_templates.exists %}
+                            <tr>
+                                <td colspan="6" class="alert-warning">
+                                    <i class="fa fa-fw fa-warning"></i> No console ports defined
+                                    {% if perms.dcim.add_consoleport %}
+                                        <a href="{% url 'dcim:consoleport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
+                                    {% endif %}
+                                </td>
+                            </tr>
+                        {% endif %}
+                    {% endfor %}
+                    {% for pp in power_ports %}
+                        {% include 'dcim/inc/powerport.html' %}
+                    {% empty %}
+                        {% if device.device_type.power_port_templates.exists %}
+                            <tr>
+                                <td colspan="6" class="alert-warning">
+                                    <i class="fa fa-fw fa-warning"></i> No power ports defined
+                                    {% if perms.dcim.add_powerport %}
+                                        <a href="{% url 'dcim:powerport_add' pk=device.pk %}" class="btn btn-primary btn-xs pull-right"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a>
+                                    {% endif %}
+                                </td>
+                            </tr>
+                        {% endif %}
+                    {% endfor %}
+                </table>
+                {% if perms.dcim.add_interface or perms.dcim.add_consoleport or perms.dcim.add_powerport %}
+                    <div class="panel-footer text-right">
+                        {% if perms.dcim.add_consoleport %}
+                            <a href="{% url 'dcim:consoleport_add' pk=device.pk %}" class="btn btn-xs btn-primary">
+                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add console port
+                            </a>
+                        {% endif %}
+                        {% if perms.dcim.add_powerport %}
+                            <a href="{% url 'dcim:powerport_add' pk=device.pk %}" class="btn btn-xs btn-primary">
+                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add power port
+                            </a>
+                        {% endif %}
+                    </div>
+                {% endif %}
+            </div>
+            {% if request.user.is_authenticated %}
+                <div class="panel panel-default">
+                    <div class="panel-heading">
+                        <strong>Secrets</strong>
+                    </div>
+                    {% if secrets %}
+                        <table class="table table-hover panel-body">
+                            {% for secret in secrets %}
+                                {% include 'secrets/inc/secret_tr.html' %}
+                            {% endfor %}
+                        </table>
+                    {% else %}
+                        <div class="panel-body text-muted">
+                            None found
+                        </div>
                     {% endif %}
-                    {% if perms.dcim.add_powerport %}
-                        <a href="{% url 'dcim:powerport_add' pk=device.pk %}" class="btn btn-xs btn-primary">
-                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add power port
-                        </a>
+                    {% if perms.secrets.add_secret %}
+                        <form id="secret_form">
+                            {% csrf_token %}
+                        </form>
+                        <div class="panel-footer text-right">
+                            <a href="{% url 'dcim:device_addsecret' pk=device.pk %}" class="btn btn-xs btn-primary">
+                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
+                                Add secret
+                            </a>
+                        </div>
                     {% endif %}
                 </div>
             {% endif %}
-        </div>
-        {% if request.user.is_authenticated %}
             <div class="panel panel-default">
                 <div class="panel-heading">
-                    <strong>Secrets</strong>
+                    <strong>Services</strong>
                 </div>
-                {% if secrets %}
+                {% if services %}
                     <table class="table table-hover panel-body">
-                        {% for secret in secrets %}
-                            {% include 'secrets/inc/secret_tr.html' %}
+                        {% for service in services %}
+                            {% include 'ipam/inc/service.html' %}
                         {% endfor %}
                     </table>
                 {% else %}
                     <div class="panel-body text-muted">
-                        None found
+                        None
                     </div>
                 {% endif %}
-                {% if perms.secrets.add_secret %}
-                    <form id="secret_form">
-                        {% csrf_token %}
-                    </form>
+                {% if perms.ipam.add_service %}
                     <div class="panel-footer text-right">
-                        <a href="{% url 'dcim:device_addsecret' pk=device.pk %}" class="btn btn-xs btn-primary">
-                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
-                            Add secret
+                        <a href="{% url 'dcim:device_service_assign' device=device.pk %}" class="btn btn-xs btn-primary">
+                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Assign service
                         </a>
                     </div>
                 {% endif %}
             </div>
-        {% endif %}
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Services</strong>
-            </div>
-            {% if services %}
-                <table class="table table-hover panel-body">
-                    {% for service in services %}
-                        {% include 'ipam/inc/service.html' %}
-                    {% endfor %}
-                </table>
-            {% else %}
-                <div class="panel-body text-muted">
-                    None
-                </div>
-            {% endif %}
-            {% if perms.ipam.add_service %}
-                <div class="panel-footer text-right">
-                    <a href="{% url 'dcim:device_service_assign' device=device.pk %}" class="btn btn-xs btn-primary">
-                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Assign service
-                    </a>
-                </div>
-            {% endif %}
-        </div>
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Images</strong>
-            </div>
-            {% include 'inc/image_attachments.html' with images=device.images.all %}
-            {% if perms.extras.add_imageattachment %}
-                <div class="panel-footer text-right">
-                    <a href="{% url 'dcim:device_add_image' object_id=device.pk %}" class="btn btn-primary btn-xs">
-                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
-                        Attach an image
-                    </a>
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Images</strong>
                 </div>
-            {% endif %}
-        </div>
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Related Devices</strong>
+                {% include 'inc/image_attachments.html' with images=device.images.all %}
+                {% if perms.extras.add_imageattachment %}
+                    <div class="panel-footer text-right">
+                        <a href="{% url 'dcim:device_add_image' object_id=device.pk %}" class="btn btn-primary btn-xs">
+                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
+                            Attach an image
+                        </a>
+                    </div>
+                {% endif %}
             </div>
-            {% if related_devices %}
-                <table class="table table-hover panel-body">
-                    {% for rd in related_devices %}
-                        <tr>
-                            <td>
-                                <a href="{% url 'dcim:device' pk=rd.pk %}">{{ rd }}</a>
-                            </td>
-                            <td>
-                                {% if rd.rack %}
-                                    <a href="{% url 'dcim:rack' pk=rd.rack.pk %}">Rack {{ rd.rack }}</a>
-                                {% else %}
-                                    <span class="text-muted">&mdash;</span>
-                                {% endif %}
-                            </td>
-                            <td>{{ rd.device_type.full_name }}</td>
-                        </tr>
-                    {% endfor %}
-                </table>
-            {% else %}
-                <div class="panel-body text-muted">None found</div>
-            {% endif %}
-        </div>
-	</div>
-</div>
-<div class="row">
-	<div class="col-md-12">
-        {% if device_bays or device.device_type.is_parent_device %}
-            {% if perms.dcim.delete_devicebay %}
-                <form method="post" action="{% url 'dcim:devicebay_bulk_delete' pk=device.pk %}">
-                {% csrf_token %}
-            {% endif %}
             <div class="panel panel-default">
                 <div class="panel-heading">
-                    <strong>Device Bays</strong>
+                    <strong>Related Devices</strong>
                 </div>
-                <table class="table table-hover table-headings panel-body component-list">
-                    <thead>
-                        <tr>
-                            {% if perms.dcim.change_devicebay or perms.dcim.delete_devicebay %}
-                                <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
-                            {% endif %}
-                            <th>Name</th>
-                            <th colspan="2">Installed Device</th>
-                            <th></th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        {% for devicebay in device_bays %}
-                            {% include 'dcim/inc/devicebay.html' %}
-                        {% empty %}
+                {% if related_devices %}
+                    <table class="table table-hover panel-body">
+                        {% for rd in related_devices %}
                             <tr>
-                                <td colspan="5" class="text-center text-muted">&mdash; No device bays defined &mdash;</td>
+                                <td>
+                                    <a href="{% url 'dcim:device' pk=rd.pk %}">{{ rd }}</a>
+                                </td>
+                                <td>
+                                    {% if rd.rack %}
+                                        <a href="{% url 'dcim:rack' pk=rd.rack.pk %}">Rack {{ rd.rack }}</a>
+                                    {% else %}
+                                        <span class="text-muted">&mdash;</span>
+                                    {% endif %}
+                                </td>
+                                <td>{{ rd.device_type.full_name }}</td>
                             </tr>
                         {% endfor %}
-                    </tbody>
-                </table>
-                <div class="panel-footer">
-                    {% if device_bays and perms.dcim.change_devicebay %}
-                        <button type="submit" name="_rename" formaction="{% url 'dcim:devicebay_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
-                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
-                        </button>
-                    {% endif %}
-                    {% if device_bays and perms.dcim.delete_devicebay %}
-                        <button type="submit" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete selected
-                        </button>
-                    {% endif %}
-                    {% if perms.dcim.add_devicebay %}
-                        <div class="pull-right">
-                            <a href="{% url 'dcim:devicebay_add' pk=device.pk %}" class="btn btn-primary btn-xs">
-                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add device bays
-                            </a>
-                        </div>
-                        <div class="clearfix"></div>
-                    {% endif %}
-                 </div>
+                    </table>
+                {% else %}
+                    <div class="panel-body text-muted">None found</div>
+                {% endif %}
             </div>
-            {% if perms.dcim.delete_devicebay %}
-                </form>
-            {% endif %}
-        {% endif %}
-        {% if interfaces or device.device_type.is_network_device %}
-            {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
-                <form method="post">
-                {% csrf_token %}
-                <input type="hidden" name="device" value="{{ device.pk }}" />
-            {% endif %}
-            <div class="panel panel-default">
-                <div class="panel-heading">
-                    <strong>Interfaces</strong>
-                    <div class="pull-right">
-                        <button class="btn btn-default btn-xs toggle-ips" selected="selected">
-                            <span class="glyphicon glyphicon-check" aria-hidden="true"></span> Show IPs
-                        </button>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-md-12">
+            {% if device_bays or device.device_type.is_parent_device %}
+                {% if perms.dcim.delete_devicebay %}
+                    <form method="post" action="{% url 'dcim:devicebay_bulk_delete' pk=device.pk %}">
+                    {% csrf_token %}
+                {% endif %}
+                <div class="panel panel-default">
+                    <div class="panel-heading">
+                        <strong>Device Bays</strong>
                     </div>
-                </div>
-                <table id="interfaces_table" class="table table-hover table-headings panel-body component-list">
-                    <thead>
-                        <tr>
-                            {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
-                                <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
-                            {% endif %}
-                            <th>Name</th>
-                            <th>LAG</th>
-                            <th>Description</th>
-                            <th>MTU</th>
-                            <th>MAC Address</th>
-                            <th colspan="2">Connection</th>
-                            <th></th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        {% for iface in interfaces %}
-                            {% include 'dcim/inc/interface.html' %}
-                        {% empty %}
+                    <table class="table table-hover table-headings panel-body component-list">
+                        <thead>
                             <tr>
-                                <td colspan="9" class="text-center text-muted">&mdash; No interfaces defined &mdash;</td>
+                                {% if perms.dcim.change_devicebay or perms.dcim.delete_devicebay %}
+                                    <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
+                                {% endif %}
+                                <th>Name</th>
+                                <th colspan="2">Installed Device</th>
+                                <th></th>
                             </tr>
-                        {% endfor %}
-                    </tbody>
-                </table>
-                <div class="panel-footer">
-                    {% if interfaces and perms.dcim.change_interface %}
-                        <button type="submit" name="_rename" formaction="{% url 'dcim:interface_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
-                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
-                        </button>
-                        <button type="submit" name="_edit" formaction="{% url 'dcim:interface_bulk_edit' pk=device.pk %}" class="btn btn-warning btn-xs">
-                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit
-                        </button>
-                    {% endif %}
-                    {% if interfaces and perms.dcim.delete_interfaceconnection %}
-                        <button type="submit" name="_disconnect" formaction="{% url 'dcim:interface_bulk_disconnect' pk=device.pk %}" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span> Disconnect
-                        </button>
-                    {% endif %}
-                    {% if interfaces and perms.dcim.delete_interface %}
-                        <button type="submit" name="_delete" formaction="{% url 'dcim:interface_bulk_delete' pk=device.pk %}" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
-                        </button>
-                    {% endif %}
-                    {% if perms.dcim.add_interface %}
+                        </thead>
+                        <tbody>
+                            {% for devicebay in device_bays %}
+                                {% include 'dcim/inc/devicebay.html' %}
+                            {% empty %}
+                                <tr>
+                                    <td colspan="5" class="text-center text-muted">&mdash; No device bays defined &mdash;</td>
+                                </tr>
+                            {% endfor %}
+                        </tbody>
+                    </table>
+                    <div class="panel-footer">
+                        {% if device_bays and perms.dcim.change_devicebay %}
+                            <button type="submit" name="_rename" formaction="{% url 'dcim:devicebay_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
+                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
+                            </button>
+                        {% endif %}
+                        {% if device_bays and perms.dcim.delete_devicebay %}
+                            <button type="submit" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete selected
+                            </button>
+                        {% endif %}
+                        {% if perms.dcim.add_devicebay %}
+                            <div class="pull-right">
+                                <a href="{% url 'dcim:devicebay_add' pk=device.pk %}" class="btn btn-primary btn-xs">
+                                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add device bays
+                                </a>
+                            </div>
+                            <div class="clearfix"></div>
+                        {% endif %}
+                     </div>
+                </div>
+                {% if perms.dcim.delete_devicebay %}
+                    </form>
+                {% endif %}
+            {% endif %}
+            {% if interfaces or device.device_type.is_network_device %}
+                {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
+                    <form method="post">
+                    {% csrf_token %}
+                    <input type="hidden" name="device" value="{{ device.pk }}" />
+                {% endif %}
+                <div class="panel panel-default">
+                    <div class="panel-heading">
+                        <strong>Interfaces</strong>
                         <div class="pull-right">
-                            <a href="{% url 'dcim:interface_add' pk=device.pk %}" class="btn btn-primary btn-xs">
-                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add interfaces
-                            </a>
+                            <button class="btn btn-default btn-xs toggle-ips" selected="selected">
+                                <span class="glyphicon glyphicon-check" aria-hidden="true"></span> Show IPs
+                            </button>
                         </div>
-                        <div class="clearfix"></div>
-                    {% endif %}
-                 </div>
-            </div>
-            {% if perms.dcim.delete_interface %}
-                </form>
-            {% endif %}
-        {% endif %}
-        {% if cs_ports or device.device_type.is_console_server %}
-            {% if perms.dcim.delete_consoleserverport %}
-                <form method="post" action="{% url 'dcim:consoleserverport_bulk_delete' pk=device.pk %}">
-                {% csrf_token %}
-            {% endif %}
-            <div class="panel panel-default">
-                <div class="panel-heading">
-                    <strong>Console Server Ports</strong>
-                </div>
-                <table class="table table-hover table-headings panel-body component-list">
-                    <thead>
-                        <tr>
-                            {% if perms.dcim.change_consoleserverport or perms.dcim.delete_consoleserverport %}
-                                <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
-                            {% endif %}
-                            <th>Name</th>
-                            <th colspan="2">Connection</th>
-                            <th></th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        {% for csp in cs_ports %}
-                            {% include 'dcim/inc/consoleserverport.html' %}
-                        {% empty %}
+                    </div>
+                    <table id="interfaces_table" class="table table-hover table-headings panel-body component-list">
+                        <thead>
                             <tr>
-                                <td colspan="5" class="text-center text-muted">&mdash; No console server ports defined &mdash;</td>
+                                {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
+                                    <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
+                                {% endif %}
+                                <th>Name</th>
+                                <th>LAG</th>
+                                <th>Description</th>
+                                <th>MTU</th>
+                                <th>MAC Address</th>
+                                <th colspan="2">Connection</th>
+                                <th></th>
                             </tr>
-                        {% endfor %}
-                    </tbody>
-                </table>
-                <div class="panel-footer">
-                    {% if cs_ports and perms.dcim.change_consoleport %}
-                        <button type="submit" name="_rename" formaction="{% url 'dcim:consoleserverport_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
-                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
-                        </button>
-                        <button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleserverport_bulk_disconnect' pk=device.pk %}" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span> Disconnect
-                        </button>
-                    {% endif %}
-                    {% if cs_ports and perms.dcim.delete_consoleserverport %}
-                        <button type="submit" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
-                        </button>
-                    {% endif %}
-                    {% if perms.dcim.add_consoleserverport %}
-                        <div class="pull-right">
-                            <a href="{% url 'dcim:consoleserverport_add' pk=device.pk %}" class="btn btn-primary btn-xs">
-                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add console server ports
-                            </a>
-                        </div>
-                        <div class="clearfix"></div>
-                    {% endif %}
+                        </thead>
+                        <tbody>
+                            {% for iface in interfaces %}
+                                {% include 'dcim/inc/interface.html' %}
+                            {% empty %}
+                                <tr>
+                                    <td colspan="9" class="text-center text-muted">&mdash; No interfaces defined &mdash;</td>
+                                </tr>
+                            {% endfor %}
+                        </tbody>
+                    </table>
+                    <div class="panel-footer">
+                        {% if interfaces and perms.dcim.change_interface %}
+                            <button type="submit" name="_rename" formaction="{% url 'dcim:interface_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
+                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
+                            </button>
+                            <button type="submit" name="_edit" formaction="{% url 'dcim:interface_bulk_edit' pk=device.pk %}" class="btn btn-warning btn-xs">
+                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit
+                            </button>
+                        {% endif %}
+                        {% if interfaces and perms.dcim.delete_interfaceconnection %}
+                            <button type="submit" name="_disconnect" formaction="{% url 'dcim:interface_bulk_disconnect' pk=device.pk %}" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span> Disconnect
+                            </button>
+                        {% endif %}
+                        {% if interfaces and perms.dcim.delete_interface %}
+                            <button type="submit" name="_delete" formaction="{% url 'dcim:interface_bulk_delete' pk=device.pk %}" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
+                            </button>
+                        {% endif %}
+                        {% if perms.dcim.add_interface %}
+                            <div class="pull-right">
+                                <a href="{% url 'dcim:interface_add' pk=device.pk %}" class="btn btn-primary btn-xs">
+                                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add interfaces
+                                </a>
+                            </div>
+                            <div class="clearfix"></div>
+                        {% endif %}
+                     </div>
                 </div>
-            </div>
-            {% if perms.dcim.delete_consoleserverport %}
-                </form>
-            {% endif %}
-        {% endif %}
-        {% if power_outlets or device.device_type.is_pdu %}
-            {% if perms.dcim.delete_poweroutlet %}
-                <form method="post" action="{% url 'dcim:poweroutlet_bulk_delete' pk=device.pk %}">
-                {% csrf_token %}
+                {% if perms.dcim.delete_interface %}
+                    </form>
+                {% endif %}
             {% endif %}
-            <div class="panel panel-default">
-                <div class="panel-heading">
-                    <strong>Power Outlets</strong>
+            {% if cs_ports or device.device_type.is_console_server %}
+                {% if perms.dcim.delete_consoleserverport %}
+                    <form method="post" action="{% url 'dcim:consoleserverport_bulk_delete' pk=device.pk %}">
+                    {% csrf_token %}
+                {% endif %}
+                <div class="panel panel-default">
+                    <div class="panel-heading">
+                        <strong>Console Server Ports</strong>
+                    </div>
+                    <table class="table table-hover table-headings panel-body component-list">
+                        <thead>
+                            <tr>
+                                {% if perms.dcim.change_consoleserverport or perms.dcim.delete_consoleserverport %}
+                                    <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
+                                {% endif %}
+                                <th>Name</th>
+                                <th colspan="2">Connection</th>
+                                <th></th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                            {% for csp in cs_ports %}
+                                {% include 'dcim/inc/consoleserverport.html' %}
+                            {% empty %}
+                                <tr>
+                                    <td colspan="5" class="text-center text-muted">&mdash; No console server ports defined &mdash;</td>
+                                </tr>
+                            {% endfor %}
+                        </tbody>
+                    </table>
+                    <div class="panel-footer">
+                        {% if cs_ports and perms.dcim.change_consoleport %}
+                            <button type="submit" name="_rename" formaction="{% url 'dcim:consoleserverport_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
+                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
+                            </button>
+                            <button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleserverport_bulk_disconnect' pk=device.pk %}" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span> Disconnect
+                            </button>
+                        {% endif %}
+                        {% if cs_ports and perms.dcim.delete_consoleserverport %}
+                            <button type="submit" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
+                            </button>
+                        {% endif %}
+                        {% if perms.dcim.add_consoleserverport %}
+                            <div class="pull-right">
+                                <a href="{% url 'dcim:consoleserverport_add' pk=device.pk %}" class="btn btn-primary btn-xs">
+                                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add console server ports
+                                </a>
+                            </div>
+                            <div class="clearfix"></div>
+                        {% endif %}
+                    </div>
                 </div>
-                <table class="table table-hover table-headings panel-body component-list">
-                    <thead>
-                        <tr>
-                            {% if perms.dcim.change_poweroutlet or perms.dcim.delete_poweroutlet %}
-                                <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
-                            {% endif %}
-                            <th>Name</th>
-                            <th colspan="2">Connection</th>
-                            <th></th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        {% for po in power_outlets %}
-                            {% include 'dcim/inc/poweroutlet.html' %}
-                        {% empty %}
+                {% if perms.dcim.delete_consoleserverport %}
+                    </form>
+                {% endif %}
+            {% endif %}
+            {% if power_outlets or device.device_type.is_pdu %}
+                {% if perms.dcim.delete_poweroutlet %}
+                    <form method="post" action="{% url 'dcim:poweroutlet_bulk_delete' pk=device.pk %}">
+                    {% csrf_token %}
+                {% endif %}
+                <div class="panel panel-default">
+                    <div class="panel-heading">
+                        <strong>Power Outlets</strong>
+                    </div>
+                    <table class="table table-hover table-headings panel-body component-list">
+                        <thead>
                             <tr>
-                                <td colspan="5" class="text-center text-muted">&mdash; No power outlets defined &mdash;</td>
+                                {% if perms.dcim.change_poweroutlet or perms.dcim.delete_poweroutlet %}
+                                    <th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
+                                {% endif %}
+                                <th>Name</th>
+                                <th colspan="2">Connection</th>
+                                <th></th>
                             </tr>
-                        {% endfor %}
-                    </tbody>
-                </table>
-                <div class="panel-footer">
-                    {% if power_outlets and perms.dcim.change_powerport %}
-                        <button type="submit" name="_rename" formaction="{% url 'dcim:poweroutlet_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
-                            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
-                        </button>
-                        <button type="submit" name="_disconnect" formaction="{% url 'dcim:poweroutlet_bulk_disconnect' pk=device.pk %}" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span> Disconnect
-                        </button>
-                    {% endif %}
-                    {% if power_outlets and perms.dcim.delete_poweroutlet %}
-                        <button type="submit" class="btn btn-danger btn-xs">
-                            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
-                        </button>
-                    {% endif %}
-                    {% if perms.dcim.add_poweroutlet %}
-                        <div class="pull-right">
-                            <a href="{% url 'dcim:poweroutlet_add' pk=device.pk %}" class="btn btn-primary btn-xs">
-                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add power outlets
-                            </a>
-                        </div>
-                        <div class="clearfix"></div>
-                    {% endif %}
+                        </thead>
+                        <tbody>
+                            {% for po in power_outlets %}
+                                {% include 'dcim/inc/poweroutlet.html' %}
+                            {% empty %}
+                                <tr>
+                                    <td colspan="5" class="text-center text-muted">&mdash; No power outlets defined &mdash;</td>
+                                </tr>
+                            {% endfor %}
+                        </tbody>
+                    </table>
+                    <div class="panel-footer">
+                        {% if power_outlets and perms.dcim.change_powerport %}
+                            <button type="submit" name="_rename" formaction="{% url 'dcim:poweroutlet_bulk_rename' %}?return_url={{ device.get_absolute_url }}" class="btn btn-warning btn-xs">
+                                <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Rename
+                            </button>
+                            <button type="submit" name="_disconnect" formaction="{% url 'dcim:poweroutlet_bulk_disconnect' pk=device.pk %}" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-resize-full" aria-hidden="true"></span> Disconnect
+                            </button>
+                        {% endif %}
+                        {% if power_outlets and perms.dcim.delete_poweroutlet %}
+                            <button type="submit" class="btn btn-danger btn-xs">
+                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete
+                            </button>
+                        {% endif %}
+                        {% if perms.dcim.add_poweroutlet %}
+                            <div class="pull-right">
+                                <a href="{% url 'dcim:poweroutlet_add' pk=device.pk %}" class="btn btn-primary btn-xs">
+                                    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Add power outlets
+                                </a>
+                            </div>
+                            <div class="clearfix"></div>
+                        {% endif %}
+                    </div>
                 </div>
-            </div>
-            {% if perms.dcim.delete_poweroutlet %}
-                </form>
+                {% if perms.dcim.delete_poweroutlet %}
+                    </form>
+                {% endif %}
             {% endif %}
-        {% endif %}
-	</div>
-</div>
+        </div>
+    </div>
 {% include 'inc/graphs_modal.html' %}
 {% include 'secrets/inc/private_key_modal.html' %}
 {% endblock %}

+ 1 - 2
netbox/templates/dcim/device_config.html

@@ -1,11 +1,10 @@
-{% extends '_base.html' %}
+{% extends 'dcim/device.html' %}
 {% load staticfiles %}
 
 {% block title %}{{ device }} - Config{% endblock %}
 
 {% block content %}
     {% include 'inc/ajax_loader.html' %}
-    {% include 'dcim/inc/device_header.html' with active_tab='config' %}
     <div class="row">
         <div class="col-md-10 col-md-offset-1">
             <div class="panel panel-default">

+ 66 - 67
netbox/templates/dcim/device_inventory.html

@@ -1,77 +1,76 @@
-{% extends '_base.html' %}
+{% extends 'dcim/device.html' %}
 
 {% block title %}{{ device }} - Inventory{% endblock %}
 
 {% block content %}
-{% include 'dcim/inc/device_header.html' with active_tab='inventory' %}
-<div class="row">
-    <div class="col-md-4">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Chassis</strong>
-            </div>
-            <table class="table table-hover panel-body attr-table">
-                <tr>
-                    <td>Model</td>
-                    <td>{{ device.device_type.full_name }}</td>
-                </tr>
-                <tr>
-                    <td>Serial Number</td>
-                    <td>
-                        {% if device.serial %}
-                            <span>{{ device.serial }}</span>
-                        {% else %}
-                            <span class="text-muted">N/A</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Asset Tag</td>
-                    <td>
-                        {% if device.asset_tag %}
-                            <span>{{ device.asset_tag }}</span>
-                        {% else %}
-                            <span class="text-muted">N/A</span>
-                        {% endif %}
-                    </td>
-                </tr>
-            </table>
-        </div>
-    </div>
-    <div class="col-md-8">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Hardware</strong>
-            </div>
-            <table class="table table-hover table-condensed panel-body" id="hardware">
-                <thead>
+    <div class="row">
+        <div class="col-md-4">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Chassis</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Model</td>
+                        <td>{{ device.device_type.full_name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Serial Number</td>
+                        <td>
+                            {% if device.serial %}
+                                <span>{{ device.serial }}</span>
+                            {% else %}
+                                <span class="text-muted">N/A</span>
+                            {% endif %}
+                        </td>
+                    </tr>
                     <tr>
-                        <th>Name</th>
-                        <th></th>
-                        <th>Manufacturer</th>
-                        <th>Part Number</th>
-                        <th>Serial Number</th>
-                        <th>Asset Tag</th>
-                        <th>Description</th>
-                        <th></th>
+                        <td>Asset Tag</td>
+                        <td>
+                            {% if device.asset_tag %}
+                                <span>{{ device.asset_tag }}</span>
+                            {% else %}
+                                <span class="text-muted">N/A</span>
+                            {% endif %}
+                        </td>
                     </tr>
-                </thead>
-                <tbody>
-                    {% for item in inventory_items %}
-                        {% with template_name='dcim/inc/inventoryitem.html' indent=0 %}
-                            {% include template_name %}
-                        {% endwith %}
-                    {% endfor %}
-                </tbody>
-            </table>
-            {% if perms.dcim.add_inventoryitem %}
-                <div class="panel-footer text-right">
-                    <a href="{% url 'dcim:inventoryitem_add' device=device.pk %}" class="btn btn-primary btn-xs">
-                        <span class="fa fa-plus" aria-hidden="true"></span> Add Inventory Item
-                    </a>
+                </table>
+            </div>
+        </div>
+        <div class="col-md-8">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Hardware</strong>
                 </div>
-            {% endif %}
+                <table class="table table-hover table-condensed panel-body" id="hardware">
+                    <thead>
+                        <tr>
+                            <th>Name</th>
+                            <th></th>
+                            <th>Manufacturer</th>
+                            <th>Part Number</th>
+                            <th>Serial Number</th>
+                            <th>Asset Tag</th>
+                            <th>Description</th>
+                            <th></th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        {% for item in inventory_items %}
+                            {% with template_name='dcim/inc/inventoryitem.html' indent=0 %}
+                                {% include template_name %}
+                            {% endwith %}
+                        {% endfor %}
+                    </tbody>
+                </table>
+                {% if perms.dcim.add_inventoryitem %}
+                    <div class="panel-footer text-right">
+                        <a href="{% url 'dcim:inventoryitem_add' device=device.pk %}" class="btn btn-primary btn-xs">
+                            <span class="fa fa-plus" aria-hidden="true"></span> Add Inventory Item
+                        </a>
+                    </div>
+                {% endif %}
+            </div>
         </div>
     </div>
-</div>
 {% endblock %}

+ 1 - 2
netbox/templates/dcim/device_lldp_neighbors.html

@@ -1,10 +1,9 @@
-{% extends '_base.html' %}
+{% extends 'dcim/device.html' %}
 
 {% block title %}{{ device }} - LLDP Neighbors{% endblock %}
 
 {% block content %}
     {% include 'inc/ajax_loader.html' %}
-    {% include 'dcim/inc/device_header.html' with active_tab='lldp-neighbors' %}
     <div class="panel panel-default">
         <div class="panel-heading">
             <strong>LLDP Neighbors</strong>

+ 1 - 2
netbox/templates/dcim/device_status.html

@@ -1,11 +1,10 @@
-{% extends '_base.html' %}
+{% extends 'dcim/device.html' %}
 {% load staticfiles %}
 
 {% block title %}{{ device }} - Status{% endblock %}
 
 {% block content %}
     {% include 'inc/ajax_loader.html' %}
-    {% include 'dcim/inc/device_header.html' with active_tab='status' %}
     <div class="row">
         <div class="col-md-6">
             <div class="panel panel-default">

+ 0 - 65
netbox/templates/dcim/inc/device_header.html

@@ -1,65 +0,0 @@
-<div class="row">
-    <div class="col-sm-8 col-md-9">
-    <ol class="breadcrumb">
-        <li><a href="{% url 'dcim:site' slug=device.site.slug %}">{{ device.site }}</a></li>
-        {% if device.rack %}
-            <li><a href="{% url 'dcim:rack_list' %}?site={{ device.site.slug }}">Racks</a></li>
-            <li><a href="{% url 'dcim:rack' pk=device.rack.pk %}">{{ device.rack }}</a></li>
-        {% endif %}
-        {% if device.parent_bay %}
-            <li><a href="{% url 'dcim:device' pk=device.parent_bay.device.pk %}">{{ device.parent_bay.device }}</a></li>
-            <li>{{ device.parent_bay }}</li>
-        {% endif %}
-        <li>{{ device }}</li>
-    </ol>
-    </div>
-    <div class="col-sm-4 col-md-3">
-        <form action="{% url 'dcim:device_list' %}" method="get">
-            <div class="input-group">
-                <input type="text" name="q" class="form-control" placeholder="Search devices" />
-                <span class="input-group-btn">
-                    <button type="submit" class="btn btn-primary">
-                        <span class="fa fa-search" aria-hidden="true"></span>
-                    </button>
-                </span>
-            </div>
-        </form>
-    </div>
-</div>
-<div class="pull-right">
-    {% if perms.dcim.change_device %}
-		<a href="{% url 'dcim:device_edit' pk=device.pk %}" class="btn btn-warning">
-			<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
-			Edit this device
-		</a>
-    {% endif %}
-    {% if perms.dcim.delete_device %}
-		<a href="{% url 'dcim:device_delete' pk=device.pk %}" class="btn btn-danger">
-			<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
-			Delete this device
-		</a>
-{% endif %}
-</div>
-<h1>{{ device }}</h1>
-{% include 'inc/created_updated.html' with obj=device %}
-<ul class="nav nav-tabs" style="margin-bottom: 20px">
-    <li role="presentation"{% if active_tab == 'info' %} class="active"{% endif %}>
-        <a href="{% url 'dcim:device' pk=device.pk %}">Info</a>
-    </li>
-    <li role="presentation"{% if active_tab == 'inventory' %} class="active"{% endif %}>
-        <a href="{% url 'dcim:device_inventory' pk=device.pk %}">Inventory</a>
-    </li>
-    {% if perms.dcim.napalm_read %}
-        {% if device.status != 1 %}
-            {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %}
-        {% elif not device.platform %}
-            {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %}
-        {% elif not device.platform.napalm_driver %}
-            {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No NAPALM driver assigned for this platform' %}
-        {% elif not device.primary_ip %}
-            {% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No primary IP address assigned to this device' %}
-        {% else %}
-            {% include 'dcim/inc/device_napalm_tabs.html' %}
-        {% endif %}
-    {% endif %}
-</ul>

+ 0 - 55
netbox/templates/ipam/inc/prefix_header.html

@@ -1,55 +0,0 @@
-<div class="row">
-    <div class="col-sm-8 col-md-9">
-        <ol class="breadcrumb">
-            <li><a href="{% url 'ipam:prefix_list' %}">Prefixes</a></li>
-            {% if prefix.vrf %}
-                <li><a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a></li>
-            {% endif %}
-            <li>{{ prefix }}</li>
-        </ol>
-    </div>
-    <div class="col-sm-4 col-md-3">
-        <form action="{% url 'ipam:prefix_list' %}" method="get">
-            <div class="input-group">
-                <input type="text" name="q" class="form-control" placeholder="Search prefixes" />
-                <span class="input-group-btn">
-                    <button type="submit" class="btn btn-primary">
-                        <span class="fa fa-search" aria-hidden="true"></span>
-                    </button>
-                </span>
-            </div>
-        </form>
-    </div>
-</div>
-<div class="pull-right">
-    {% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
-        <a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ prefix.vrf.pk }}&site={{ prefix.site.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success">
-            <i class="fa fa-plus" aria-hidden="true"></i> Add Child Prefix
-        </a>
-    {% endif %}
-    {% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
-		<a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ prefix.vrf.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success">
-			<span class="fa fa-plus" aria-hidden="true"></span>
-			Add an IP Address
-		</a>
-    {% endif %}
-    {% if perms.ipam.change_prefix %}
-		<a href="{% url 'ipam:prefix_edit' pk=prefix.pk %}" class="btn btn-warning">
-			<span class="fa fa-pencil" aria-hidden="true"></span>
-			Edit this prefix
-		</a>
-    {% endif %}
-    {% if perms.ipam.delete_prefix %}
-		<a href="{% url 'ipam:prefix_delete' pk=prefix.pk %}" class="btn btn-danger">
-			<span class="fa fa-trash" aria-hidden="true"></span>
-			Delete this prefix
-		</a>
-    {% endif %}
-</div>
-<h1>{{ prefix }}</h1>
-{% include 'inc/created_updated.html' with obj=prefix %}
-<ul class="nav nav-tabs" style="margin-bottom: 20px">
-    <li role="presentation"{% if active_tab == 'prefix' %} class="active"{% endif %}><a href="{% url 'ipam:prefix' pk=prefix.pk %}">Prefix</a></li>
-    <li role="presentation"{% if active_tab == 'prefixes' %} class="active"{% endif %}><a href="{% url 'ipam:prefix_prefixes' pk=prefix.pk %}">Child Prefixes <span class="badge">{{ prefix.get_child_prefixes.count }}</span></a></li>
-    <li role="presentation"{% if active_tab == 'ip-addresses' %} class="active"{% endif %}><a href="{% url 'ipam:prefix_ipaddresses' pk=prefix.pk %}">IP Addresses <span class="badge">{{ prefix.get_child_ips.count }}</span></a></li>
-</ul>

+ 0 - 46
netbox/templates/ipam/inc/vlan_header.html

@@ -1,46 +0,0 @@
-<div class="row">
-    <div class="col-sm-8 col-md-9">
-        <ol class="breadcrumb">
-            <li><a href="{% url 'ipam:vlan_list' %}">VLANs</a></li>
-            {% if vlan.site %}
-                <li><a href="{% url 'ipam:vlan_list' %}?site={{ vlan.site.slug }}">{{ vlan.site }}</a></li>
-            {% endif %}
-            {% if vlan.group %}
-                <li><a href="{% url 'ipam:vlan_list' %}?group={{ vlan.group.slug }}">{{ vlan.group }}</a></li>
-            {% endif %}
-            <li>{{ vlan }}</li>
-        </ol>
-    </div>
-    <div class="col-sm-4 col-md-3">
-    <form action="{% url 'ipam:vlan_list' %}" method="get">
-        <div class="input-group">
-            <input type="text" name="q" class="form-control" placeholder="Search VLANs" />
-            <span class="input-group-btn">
-                <button type="submit" class="btn btn-primary">
-                    <span class="fa fa-search" aria-hidden="true"></span>
-                </button>
-            </span>
-        </div>
-    </form>
-    </div>
-</div>
-<div class="pull-right">
-    {% if perms.ipam.change_vlan %}
-        <a href="{% url 'ipam:vlan_edit' pk=vlan.pk %}" class="btn btn-warning">
-            <span class="fa fa-pencil" aria-hidden="true"></span>
-            Edit this VLAN
-        </a>
-    {% endif %}
-    {% if perms.ipam.delete_vlan %}
-        <a href="{% url 'ipam:vlan_delete' pk=vlan.pk %}" class="btn btn-danger">
-            <span class="fa fa-trash" aria-hidden="true"></span>
-            Delete this VLAN
-        </a>
-    {% endif %}
-</div>
-<h1>{% block title %}VLAN {{ vlan.display_name }}{% endblock %}</h1>
-{% include 'inc/created_updated.html' with obj=vlan %}
-<ul class="nav nav-tabs" style="margin-bottom: 20px">
-    <li role="presentation"{% if active_tab == 'vlan' %} class="active"{% endif %}><a href="{% url 'ipam:vlan' pk=vlan.pk %}">VLAN</a></li>
-    <li role="presentation"{% if active_tab == 'members' %} class="active"{% endif %}><a href="{% url 'ipam:vlan_members' pk=vlan.pk %}">Members <span class="badge">{{ vlan.get_members.count }}</span></a></li>
-</ul>

+ 196 - 141
netbox/templates/ipam/prefix.html

@@ -1,152 +1,207 @@
 {% extends '_base.html' %}
 {% load helpers %}
 
-{% block title %}{{ prefix }}{% endblock %}
+{% block header %}
+    <div class="row">
+        <div class="col-sm-8 col-md-9">
+            <ol class="breadcrumb">
+                <li><a href="{% url 'ipam:prefix_list' %}">Prefixes</a></li>
+                {% if prefix.vrf %}
+                    <li><a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a></li>
+                {% endif %}
+                <li>{{ prefix }}</li>
+            </ol>
+        </div>
+        <div class="col-sm-4 col-md-3">
+            <form action="{% url 'ipam:prefix_list' %}" method="get">
+                <div class="input-group">
+                    <input type="text" name="q" class="form-control" placeholder="Search prefixes" />
+                    <span class="input-group-btn">
+                        <button type="submit" class="btn btn-primary">
+                            <span class="fa fa-search" aria-hidden="true"></span>
+                        </button>
+                    </span>
+                </div>
+            </form>
+        </div>
+    </div>
+    <div class="pull-right">
+        {% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
+            <a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ prefix.vrf.pk }}&site={{ prefix.site.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success">
+                <i class="fa fa-plus" aria-hidden="true"></i> Add Child Prefix
+            </a>
+        {% endif %}
+        {% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
+            <a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ prefix.vrf.pk }}&tenant_group={{ prefix.tenant.group.pk }}&tenant={{ prefix.tenant.pk }}" class="btn btn-success">
+                <span class="fa fa-plus" aria-hidden="true"></span>
+                Add an IP Address
+            </a>
+        {% endif %}
+        {% if perms.ipam.change_prefix %}
+            <a href="{% url 'ipam:prefix_edit' pk=prefix.pk %}" class="btn btn-warning">
+                <span class="fa fa-pencil" aria-hidden="true"></span>
+                Edit this prefix
+            </a>
+        {% endif %}
+        {% if perms.ipam.delete_prefix %}
+            <a href="{% url 'ipam:prefix_delete' pk=prefix.pk %}" class="btn btn-danger">
+                <span class="fa fa-trash" aria-hidden="true"></span>
+                Delete this prefix
+            </a>
+        {% endif %}
+    </div>
+    <h1>{% block title %}{{ prefix }}{% endblock %}</h1>
+    {% include 'inc/created_updated.html' with obj=prefix %}
+    <ul class="nav nav-tabs" style="margin-bottom: 20px">
+        <li role="presentation"{% if not active_tab %} class="active"{% endif %}><a href="{% url 'ipam:prefix' pk=prefix.pk %}">Prefix</a></li>
+        <li role="presentation"{% if active_tab == 'prefixes' %} class="active"{% endif %}><a href="{% url 'ipam:prefix_prefixes' pk=prefix.pk %}">Child Prefixes <span class="badge">{{ prefix.get_child_prefixes.count }}</span></a></li>
+        <li role="presentation"{% if active_tab == 'ip-addresses' %} class="active"{% endif %}><a href="{% url 'ipam:prefix_ipaddresses' pk=prefix.pk %}">IP Addresses <span class="badge">{{ prefix.get_child_ips.count }}</span></a></li>
+    </ul>
+{% endblock %}
 
 {% block content %}
-{% include 'ipam/inc/prefix_header.html' with active_tab='prefix' %}
-<div class="row">
-	<div class="col-md-5">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Prefix</strong>
-            </div>
-            <table class="table table-hover panel-body attr-table">
-                <tr>
-                    <td>Family</td>
-                    <td>{{ prefix.get_family_display }}</td>
-                </tr>
-                <tr>
-                    <td>VRF</td>
-                    <td>
-                        {% if prefix.vrf %}
-                            <a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a> ({{ prefix.vrf.rd }})
-                        {% else %}
-                            <span>Global</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Tenant</td>
-                    <td>
-                        {% if prefix.tenant %}
-                            {% if prefix.tenant.group %}
-                                <a href="{{ prefix.tenant.group.get_absolute_url }}">{{ prefix.tenant.group }}</a>
-                                <i class="fa fa-angle-right"></i>
+    <div class="row">
+        <div class="col-md-5">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Prefix</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Family</td>
+                        <td>{{ prefix.get_family_display }}</td>
+                    </tr>
+                    <tr>
+                        <td>VRF</td>
+                        <td>
+                            {% if prefix.vrf %}
+                                <a href="{% url 'ipam:vrf' pk=prefix.vrf.pk %}">{{ prefix.vrf }}</a> ({{ prefix.vrf.rd }})
+                            {% else %}
+                                <span>Global</span>
                             {% endif %}
-                            <a href="{{ prefix.tenant.get_absolute_url }}">{{ prefix.tenant }}</a>
-                        {% elif prefix.vrf.tenant %}
-                            {% if prefix.vrf.tenant.group %}
-                                <a href="{{ prefix.vrf.tenant.group.get_absolute_url }}">{{ prefix.vrf.tenant.group }}</a>
-                                <i class="fa fa-angle-right"></i>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Tenant</td>
+                        <td>
+                            {% if prefix.tenant %}
+                                {% if prefix.tenant.group %}
+                                    <a href="{{ prefix.tenant.group.get_absolute_url }}">{{ prefix.tenant.group }}</a>
+                                    <i class="fa fa-angle-right"></i>
+                                {% endif %}
+                                <a href="{{ prefix.tenant.get_absolute_url }}">{{ prefix.tenant }}</a>
+                            {% elif prefix.vrf.tenant %}
+                                {% if prefix.vrf.tenant.group %}
+                                    <a href="{{ prefix.vrf.tenant.group.get_absolute_url }}">{{ prefix.vrf.tenant.group }}</a>
+                                    <i class="fa fa-angle-right"></i>
+                                {% endif %}
+                                <a href="{{ prefix.vrf.tenant.get_absolute_url }}">{{ prefix.vrf.tenant }}</a>
+                                <label class="label label-info">Inherited</label>
+                            {% else %}
+                                <span class="text-muted">None</span>
                             {% endif %}
-                            <a href="{{ prefix.vrf.tenant.get_absolute_url }}">{{ prefix.vrf.tenant }}</a>
-                            <label class="label label-info">Inherited</label>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Aggregate</td>
-                    <td>
-                        {% if aggregate %}
-                            <a href="{% url 'ipam:aggregate' pk=aggregate.pk %}">{{ aggregate.prefix }}</a> ({{ aggregate.rir }})
-                        {% else %}
-                            <span class="text-warning">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Site</td>
-                    <td>
-                        {% if prefix.site %}
-                            {% if prefix.site.region %}
-                                <a href="{{ prefix.site.region.get_absolute_url }}">{{ prefix.site.region }}</a>
-                                <i class="fa fa-angle-right"></i>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Aggregate</td>
+                        <td>
+                            {% if aggregate %}
+                                <a href="{% url 'ipam:aggregate' pk=aggregate.pk %}">{{ aggregate.prefix }}</a> ({{ aggregate.rir }})
+                            {% else %}
+                                <span class="text-warning">None</span>
                             {% endif %}
-                            <a href="{% url 'dcim:site' slug=prefix.site.slug %}">{{ prefix.site }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>VLAN</td>
-                    <td>
-                        {% if prefix.vlan %}
-                            {% if prefix.vlan.group %}
-                                <a href="{{ prefix.vlan.group.get_absolute_url }}">{{ prefix.vlan.group }}</a>
-                                <i class="fa fa-angle-right"></i>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Site</td>
+                        <td>
+                            {% if prefix.site %}
+                                {% if prefix.site.region %}
+                                    <a href="{{ prefix.site.region.get_absolute_url }}">{{ prefix.site.region }}</a>
+                                    <i class="fa fa-angle-right"></i>
+                                {% endif %}
+                                <a href="{% url 'dcim:site' slug=prefix.site.slug %}">{{ prefix.site }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
                             {% endif %}
-                            <a href="{% url 'ipam:vlan' pk=prefix.vlan.pk %}">{{ prefix.vlan.display_name }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Status</td>
-                    <td>
-                        <span class="label label-{{ prefix.get_status_class }}">{{ prefix.get_status_display }}</span>
-                    </td>
-                </tr>
-                <tr>
-                    <td>Role</td>
-                    <td>
-                        {% if prefix.role %}
-                            <a href="{% url 'ipam:prefix_list' %}?role={{ prefix.role.slug }}">{{ prefix.role }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Description</td>
-                    <td>
-                        {% if prefix.description %}
-                            <span>{{ prefix.description }}</span>
-                        {% else %}
-                            <span class="text-muted">N/A</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Is a pool</td>
-                    <td>
-                        {% if prefix.is_pool %}
-                            <i class="glyphicon glyphicon-ok text-success" title="Yes"></i>
-                        {% else %}
-                            <i class="glyphicon glyphicon-remove text-danger" title="No"></i>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Tags</td>
-                    <td>
-                        {% for tag in prefix.tags.all %}
-                            {% tag 'ipam:prefix_list' tag %}
-                        {% empty %}
-                            <span class="text-muted">N/A</span>
-                        {% endfor %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Utilization</td>
-                    <td>{% utilization_graph prefix.get_utilization %}</td>
-                </tr>
-            </table>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>VLAN</td>
+                        <td>
+                            {% if prefix.vlan %}
+                                {% if prefix.vlan.group %}
+                                    <a href="{{ prefix.vlan.group.get_absolute_url }}">{{ prefix.vlan.group }}</a>
+                                    <i class="fa fa-angle-right"></i>
+                                {% endif %}
+                                <a href="{% url 'ipam:vlan' pk=prefix.vlan.pk %}">{{ prefix.vlan.display_name }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Status</td>
+                        <td>
+                            <span class="label label-{{ prefix.get_status_class }}">{{ prefix.get_status_display }}</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Role</td>
+                        <td>
+                            {% if prefix.role %}
+                                <a href="{% url 'ipam:prefix_list' %}?role={{ prefix.role.slug }}">{{ prefix.role }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>
+                            {% if prefix.description %}
+                                <span>{{ prefix.description }}</span>
+                            {% else %}
+                                <span class="text-muted">N/A</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Is a pool</td>
+                        <td>
+                            {% if prefix.is_pool %}
+                                <i class="glyphicon glyphicon-ok text-success" title="Yes"></i>
+                            {% else %}
+                                <i class="glyphicon glyphicon-remove text-danger" title="No"></i>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Tags</td>
+                        <td>
+                            {% for tag in prefix.tags.all %}
+                                {% tag 'ipam:prefix_list' tag %}
+                            {% empty %}
+                                <span class="text-muted">N/A</span>
+                            {% endfor %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Utilization</td>
+                        <td>{% utilization_graph prefix.get_utilization %}</td>
+                    </tr>
+                </table>
+            </div>
+            {% with prefix.get_custom_fields as custom_fields %}
+                {% include 'inc/custom_fields_panel.html' %}
+            {% endwith %}
+            <br />
         </div>
-        {% with prefix.get_custom_fields as custom_fields %}
-            {% include 'inc/custom_fields_panel.html' %}
-        {% endwith %}
-        <br />
-	</div>
-	<div class="col-md-7">
-        {% if duplicate_prefix_table.rows %}
-            {% include 'panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' panel_class='danger' %}
-        {% endif %}
-        {% include 'panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' panel_class='default' %}
-	</div>
-</div>
+        <div class="col-md-7">
+            {% if duplicate_prefix_table.rows %}
+                {% include 'panel_table.html' with table=duplicate_prefix_table heading='Duplicate Prefixes' panel_class='danger' %}
+            {% endif %}
+            {% include 'panel_table.html' with table=parent_prefix_table heading='Parent Prefixes' panel_class='default' %}
+        </div>
+    </div>
 {% endblock %}

+ 2 - 3
netbox/templates/ipam/prefix_ipaddresses.html

@@ -1,9 +1,8 @@
-{% extends '_base.html' %}
+{% extends 'ipam/prefix.html' %}
 
-{% block title %}{{ prefix }} - IP Addresses{% endblock %}
+{% block title %}{{ block.super }} - IP Addresses{% endblock %}
 
 {% block content %}
-    {% include 'ipam/inc/prefix_header.html' with active_tab='ip-addresses' %}
     <div class="row">
         <div class="col-md-12">
             {% 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' %}

+ 2 - 3
netbox/templates/ipam/prefix_prefixes.html

@@ -1,9 +1,8 @@
-{% extends '_base.html' %}
+{% extends 'ipam/prefix.html' %}
 
-{% block title %}{{ prefix }} - Prefixes{% endblock %}
+{% block title %}{{ block.super }} - Prefixes{% endblock %}
 
 {% block content %}
-    {% include 'ipam/inc/prefix_header.html' with active_tab='prefixes' %}
     <div class="row">
         <div class="col-md-12">
             {% 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 %}

+ 156 - 108
netbox/templates/ipam/vlan.html

@@ -1,118 +1,166 @@
 {% extends '_base.html' %}
 {% load helpers %}
 
-{% block content %}
-{% include 'ipam/inc/vlan_header.html' with active_tab='vlan' %}
-<div class="row">
-	<div class="col-md-6">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>VLAN</strong>
+{% block header %}
+    <div class="row">
+        <div class="col-sm-8 col-md-9">
+            <ol class="breadcrumb">
+                <li><a href="{% url 'ipam:vlan_list' %}">VLANs</a></li>
+                {% if vlan.site %}
+                    <li><a href="{% url 'ipam:vlan_list' %}?site={{ vlan.site.slug }}">{{ vlan.site }}</a></li>
+                {% endif %}
+                {% if vlan.group %}
+                    <li><a href="{% url 'ipam:vlan_list' %}?group={{ vlan.group.slug }}">{{ vlan.group }}</a></li>
+                {% endif %}
+                <li>{{ vlan }}</li>
+            </ol>
+        </div>
+        <div class="col-sm-4 col-md-3">
+        <form action="{% url 'ipam:vlan_list' %}" method="get">
+            <div class="input-group">
+                <input type="text" name="q" class="form-control" placeholder="Search VLANs" />
+                <span class="input-group-btn">
+                    <button type="submit" class="btn btn-primary">
+                        <span class="fa fa-search" aria-hidden="true"></span>
+                    </button>
+                </span>
             </div>
-            <table class="table table-hover panel-body attr-table">
-                <tr>
-                    <td>Site</td>
-                    <td>
-                        {% if vlan.site %}
-                            {% if vlan.site.region %}
-                                <a href="{{ vlan.site.region.get_absolute_url }}">{{ vlan.site.region }}</a>
-                                <i class="fa fa-angle-right"></i>
+        </form>
+        </div>
+    </div>
+    <div class="pull-right">
+        {% if perms.ipam.change_vlan %}
+            <a href="{% url 'ipam:vlan_edit' pk=vlan.pk %}" class="btn btn-warning">
+                <span class="fa fa-pencil" aria-hidden="true"></span>
+                Edit this VLAN
+            </a>
+        {% endif %}
+        {% if perms.ipam.delete_vlan %}
+            <a href="{% url 'ipam:vlan_delete' pk=vlan.pk %}" class="btn btn-danger">
+                <span class="fa fa-trash" aria-hidden="true"></span>
+                Delete this VLAN
+            </a>
+        {% endif %}
+    </div>
+    <h1>{% block title %}VLAN {{ vlan.display_name }}{% endblock %}</h1>
+    {% include 'inc/created_updated.html' with obj=vlan %}
+    <ul class="nav nav-tabs" style="margin-bottom: 20px">
+        <li role="presentation"{% if not active_tab %} class="active"{% endif %}><a href="{% url 'ipam:vlan' pk=vlan.pk %}">VLAN</a></li>
+        <li role="presentation"{% if active_tab == 'members' %} class="active"{% endif %}><a href="{% url 'ipam:vlan_members' pk=vlan.pk %}">Members <span class="badge">{{ vlan.get_members.count }}</span></a></li>
+    </ul>
+{% endblock %}
+
+{% block content %}
+    <div class="row">
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>VLAN</strong>
+                </div>
+                <table class="table table-hover panel-body attr-table">
+                    <tr>
+                        <td>Site</td>
+                        <td>
+                            {% if vlan.site %}
+                                {% if vlan.site.region %}
+                                    <a href="{{ vlan.site.region.get_absolute_url }}">{{ vlan.site.region }}</a>
+                                    <i class="fa fa-angle-right"></i>
+                                {% endif %}
+                                <a href="{% url 'dcim:site' slug=vlan.site.slug %}">{{ vlan.site }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
                             {% endif %}
-                            <a href="{% url 'dcim:site' slug=vlan.site.slug %}">{{ vlan.site }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Group</td>
-                    <td>
-                        {% if vlan.group %}
-                            <a href="{{ vlan.group.get_absolute_url }}">{{ vlan.group }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>VLAN ID</td>
-                    <td>{{ vlan.vid }}</td>
-                </tr>
-                <tr>
-                    <td>Name</td>
-                    <td>{{ vlan.name }}</td>
-                </tr>
-                <tr>
-                    <td>Tenant</td>
-                    <td>
-                        {% if vlan.tenant %}
-                            {% if vlan.tenant.group %}
-                                <a href="{{ vlan.tenant.group.get_absolute_url }}">{{ vlan.tenant.group }}</a>
-                                <i class="fa fa-angle-right"></i>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Group</td>
+                        <td>
+                            {% if vlan.group %}
+                                <a href="{{ vlan.group.get_absolute_url }}">{{ vlan.group }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
                             {% endif %}
-                            <a href="{{ vlan.tenant.get_absolute_url }}">{{ vlan.tenant }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Status</td>
-                    <td>
-                        <span class="label label-{{ vlan.get_status_class }}">{{ vlan.get_status_display }}</span>
-                    </td>
-                </tr>
-                <tr>
-                    <td>Role</td>
-                    <td>
-                        {% if vlan.role %}
-                            <a href="{% url 'ipam:vlan_list' %}?role={{ vlan.role.slug }}">{{ vlan.role }}</a>
-                        {% else %}
-                            <span class="text-muted">None</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Description</td>
-                    <td>
-                        {% if vlan.description %}
-                            {{ vlan.description }}
-                        {% else %}
-                            <span class="text-muted">N/A</span>
-                        {% endif %}
-                    </td>
-                </tr>
-                <tr>
-                    <td>Tags</td>
-                    <td>
-                        {% for tag in vlan.tags.all %}
-                            {% tag 'ipam:vlan_list' tag %}
-                        {% empty %}
-                            <span class="text-muted">N/A</span>
-                        {% endfor %}
-                    </td>
-                </tr>
-		    </table>
-        </div>
-        {% with vlan.get_custom_fields as custom_fields %}
-            {% include 'inc/custom_fields_panel.html' %}
-        {% endwith %}
-	</div>
-	<div class="col-md-6">
-        <div class="panel panel-default">
-            <div class="panel-heading">
-                <strong>Prefixes</strong>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>VLAN ID</td>
+                        <td>{{ vlan.vid }}</td>
+                    </tr>
+                    <tr>
+                        <td>Name</td>
+                        <td>{{ vlan.name }}</td>
+                    </tr>
+                    <tr>
+                        <td>Tenant</td>
+                        <td>
+                            {% if vlan.tenant %}
+                                {% if vlan.tenant.group %}
+                                    <a href="{{ vlan.tenant.group.get_absolute_url }}">{{ vlan.tenant.group }}</a>
+                                    <i class="fa fa-angle-right"></i>
+                                {% endif %}
+                                <a href="{{ vlan.tenant.get_absolute_url }}">{{ vlan.tenant }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Status</td>
+                        <td>
+                            <span class="label label-{{ vlan.get_status_class }}">{{ vlan.get_status_display }}</span>
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Role</td>
+                        <td>
+                            {% if vlan.role %}
+                                <a href="{% url 'ipam:vlan_list' %}?role={{ vlan.role.slug }}">{{ vlan.role }}</a>
+                            {% else %}
+                                <span class="text-muted">None</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Description</td>
+                        <td>
+                            {% if vlan.description %}
+                                {{ vlan.description }}
+                            {% else %}
+                                <span class="text-muted">N/A</span>
+                            {% endif %}
+                        </td>
+                    </tr>
+                    <tr>
+                        <td>Tags</td>
+                        <td>
+                            {% for tag in vlan.tags.all %}
+                                {% tag 'ipam:vlan_list' tag %}
+                            {% empty %}
+                                <span class="text-muted">N/A</span>
+                            {% endfor %}
+                        </td>
+                    </tr>
+                </table>
             </div>
-            {% include 'responsive_table.html' with table=prefix_table %}
-            {% if perms.ipam.add_prefix %}
-                <div class="panel-footer text-right">
-                    <a href="{% url 'ipam:prefix_add' %}?{% if vlan.tenant %}tenant={{ vlan.tenant.pk }}&{% endif %}site={{ vlan.site.pk }}&vlan={{ vlan.pk }}" class="btn btn-primary btn-xs">
-                        <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
-                        Add a prefix
-                    </a>
+            {% with vlan.get_custom_fields as custom_fields %}
+                {% include 'inc/custom_fields_panel.html' %}
+            {% endwith %}
+        </div>
+        <div class="col-md-6">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <strong>Prefixes</strong>
                 </div>
-            {% endif %}
+                {% include 'responsive_table.html' with table=prefix_table %}
+                {% if perms.ipam.add_prefix %}
+                    <div class="panel-footer text-right">
+                        <a href="{% url 'ipam:prefix_add' %}?{% if vlan.tenant %}tenant={{ vlan.tenant.pk }}&{% endif %}site={{ vlan.site.pk }}&vlan={{ vlan.pk }}" class="btn btn-primary btn-xs">
+                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
+                            Add a prefix
+                        </a>
+                    </div>
+                {% endif %}
+            </div>
         </div>
-	</div>
-</div>
+    </div>
 {% endblock %}

+ 2 - 3
netbox/templates/ipam/vlan_members.html

@@ -1,9 +1,8 @@
-{% extends '_base.html' %}
+{% extends 'ipam/vlan.html' %}
 
-{% block title %}{{ vlan }} - Members{% endblock %}
+{% block title %}{{ block.super }} - Members{% endblock %}
 
 {% block content %}
-    {% include 'ipam/inc/vlan_header.html' with active_tab='members' %}
     <div class="row">
         <div class="col-md-12">
             {% include 'utilities/obj_table.html' with table=members_table table_template='panel_table.html' heading='VLAN Members' parent=vlan %}