Clean up templates

This commit is contained in:
Jeremy Stretch 2024-07-16 08:43:16 -04:00
parent fdb5bb6a1a
commit abab214222
4 changed files with 184 additions and 216 deletions

View File

@ -0,0 +1,48 @@
{% load i18n %}
<div class="card">
<h5 class="card-header">{% trans "Dimensions" %}</h5>
<table class="table table-hover attr-table">
<tr>
<th scope="row">{% trans "Form factor" %}</th>
<td>{{ object.get_form_factor_display|placeholder }}</td>
</tr>
<tr>
<th scope="row">{% trans "Width" %}</th>
<td>{{ object.get_width_display }}</td>
</tr>
<tr>
<th scope="row">{% trans "Height" %}</th>
<td>{{ object.u_height }}U</td>
</tr>
<tr>
<th scope="row">{% trans "Outer Width" %}</th>
<td>
{% if object.outer_width %}
{{ object.outer_width }} {{ object.get_outer_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Outer Depth" %}</th>
<td>
{% if object.outer_depth %}
{{ object.outer_depth }} {{ object.get_outer_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Mounting Depth" %}</th>
<td>
{% if object.mounting_depth %}
{{ object.mounting_depth }} {% trans "Millimeters" %}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
</table>
</div>

View File

@ -0,0 +1,14 @@
{% load i18n %}
<div class="card">
<h5 class="card-header">{% trans "Numbering" %}</h5>
<table class="table table-hover attr-table">
<tr>
<th scope="row">{% trans "Starting Unit" %}</th>
<td>{{ object.starting_unit }}</td>
</tr>
<tr>
<th scope="row">{% trans "Descending Units" %}</th>
<td>{% checkmark object.desc_units %}</td>
</tr>
</table>
</div>

View File

@ -9,155 +9,107 @@
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col col-12 col-xl-5"> <div class="col col-12 col-xl-5">
<div class="card"> <div class="card">
<h5 class="card-header">{% trans "Rack" %}</h5> <h5 class="card-header">{% trans "Rack" %}</h5>
<table class="table table-hover attr-table"> <table class="table table-hover attr-table">
<tr> <tr>
<th scope="row">{% trans "Region" %}</th> <th scope="row">{% trans "Region" %}</th>
<td> <td>{% nested_tree object.site.region %}</td>
{% nested_tree object.site.region %} </tr>
</td> <tr>
</tr> <th scope="row">{% trans "Site" %}</th>
<tr> <td>{{ object.site|linkify }}</td>
<th scope="row">{% trans "Site" %}</th> </tr>
<td>{{ object.site|linkify }}</td> <tr>
</tr> <th scope="row">{% trans "Location" %}</th>
<tr> <td>{% nested_tree object.location %}</td>
<th scope="row">{% trans "Location" %}</th> </tr>
<td>{% nested_tree object.location %}</td> <tr>
</tr> <th scope="row">{% trans "Facility ID" %}</th>
<tr> <td>{{ object.facility_id|placeholder }}</td>
<th scope="row">{% trans "Facility ID" %}</th> </tr>
<td>{{ object.facility_id|placeholder }}</td> <tr>
</tr> <th scope="row">{% trans "Tenant" %}</th>
<tr> <td>
<th scope="row">{% trans "Tenant" %}</th> {% if object.tenant.group %}
<td> {{ object.tenant.group|linkify }} /
{% if object.tenant.group %} {% endif %}
{{ object.tenant.group|linkify }} / {{ object.tenant|linkify|placeholder }}
{% endif %} </td>
{{ object.tenant|linkify|placeholder }} </tr>
</td> <tr>
</tr> <th scope="row">{% trans "Status" %}</th>
<tr> <td>{% badge object.get_status_display bg_color=object.get_status_color %}</td>
<th scope="row">{% trans "Status" %}</th> </tr>
<td>{% badge object.get_status_display bg_color=object.get_status_color %}</td> <tr>
</tr> <th scope="row">{% trans "Rack Type" %}</th>
<tr> <td>{{ object.rack_type|linkify|placeholder }}</td>
<th scope="row">{% trans "Rack Type" %}</th> </tr>
<td>{{ object.rack_type|linkify|placeholder }}</td> <tr>
</tr> <th scope="row">{% trans "Role" %}</th>
<tr> <td>{{ object.role|linkify|placeholder }}</td>
<th scope="row">{% trans "Role" %}</th> </tr>
<td>{{ object.role|linkify|placeholder }}</td> <tr>
</tr> <th scope="row">{% trans "Description" %}</th>
<tr> <td>{{ object.description|placeholder }}</td>
<th scope="row">{% trans "Description" %}</th> </tr>
<td>{{ object.description|placeholder }}</td> <tr>
</tr> <th scope="row">{% trans "Serial Number" %}</th>
<tr> <td class="font-monospace">{{ object.serial|placeholder }}</td>
<th scope="row">{% trans "Serial Number" %}</th> </tr>
<td class="font-monospace">{{ object.serial|placeholder }}</td> <tr>
</tr> <th scope="row">{% trans "Asset Tag" %}</th>
<tr> <td class="font-monospace">{{ object.asset_tag|placeholder }}</td>
<th scope="row">{% trans "Asset Tag" %}</th> </tr>
<td class="font-monospace">{{ object.asset_tag|placeholder }}</td> <tr>
</tr> <th scope="row">{% trans "Space Utilization" %}</th>
<tr> <td>{% utilization_graph object.get_utilization %}</td>
<th scope="row">{% trans "Space Utilization" %}</th> </tr>
<td>{% utilization_graph object.get_utilization %}</td> <tr>
</tr> <th scope="row">{% trans "Power Utilization" %}</th>
<tr> <td>{% utilization_graph object.get_power_utilization %}</td>
<th scope="row">{% trans "Power Utilization" %}</th> </tr>
<td>{% utilization_graph object.get_power_utilization %}</td> </table>
</tr> </div>
</table> {% include 'dcim/inc/panels/racktype_dimensions.html' %}
</div> {% include 'dcim/inc/panels/racktype_numbering.html' %}
<div class="card"> <div class="card">
<h5 class="card-header">{% trans "Dimensions" %}</h5> <h5 class="card-header">{% trans "Weight" %}</h5>
<table class="table table-hover attr-table"> <table class="table table-hover attr-table">
<tr> <tr>
<th scope="row">{% trans "Form factor" %}</th> <th scope="row">{% trans "Rack Weight" %}</th>
<td>{{ object.get_form_factor_display|placeholder }}</td> <td>
</tr> {% if object.weight %}
<tr> {{ object.weight|floatformat }} {{ object.get_weight_unit_display }}
<th scope="row">{% trans "Width" %}</th> {% else %}
<td>{{ object.get_width_display }}</td> {{ ''|placeholder }}
</tr> {% endif %}
<tr> </td>
<th scope="row">{% trans "Height" %}</th> </tr>
<td>{{ object.u_height }}U ({% if object.desc_units %}{% trans "descending" %}{% else %}{% trans "ascending" %}{% endif %})</td> <tr>
</tr> <th scope="row">{% trans "Maximum Weight" %}</th>
<tr> <td>
<th scope="row">{% trans "Starting Unit" %}</th> {% if object.max_weight %}
<td> {{ object.max_weight }} {{ object.get_weight_unit_display }}
{{ object.starting_unit }} {% else %}
</td> {{ ''|placeholder }}
</tr> {% endif %}
<tr> </td>
<th scope="row">{% trans "Outer Width" %}</th> </tr>
<td> <tr>
{% if object.outer_width %} <th scope="row">{% trans "Total Weight" %}</th>
{{ object.outer_width }} {{ object.get_outer_unit_display }} <td>
{% else %} {{ object.total_weight|floatformat }} {% trans "Kilograms" %}
{{ ''|placeholder }} ({{ object.total_weight|kg_to_pounds|floatformat }} {% trans "Pounds" %})
{% endif %} </td>
</td> </tr>
</tr> </table>
<tr> </div>
<th scope="row">{% trans "Outer Depth" %}</th> {% include 'inc/panels/custom_fields.html' %}
<td> {% include 'inc/panels/tags.html' %}
{% if object.outer_depth %} {% include 'inc/panels/comments.html' %}
{{ object.outer_depth }} {{ object.get_outer_unit_display }} {% include 'inc/panels/image_attachments.html' %}
{% else %} {% plugin_left_page object %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Mounting Depth" %}</th>
<td>
{% if object.mounting_depth %}
{{ object.mounting_depth }} {% trans "Millimeters" %}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Rack Weight" %}</th>
<td>
{% if object.weight %}
{{ object.weight|floatformat }} {{ object.get_weight_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Maximum Weight" %}</th>
<td>
{% if object.max_weight %}
{{ object.max_weight }} {{ object.get_weight_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Total Weight" %}</th>
<td>
{{ object.total_weight|floatformat }} {% trans "Kilograms" %}
({{ object.total_weight|kg_to_pounds|floatformat }} {% trans "Pounds" %})
</td>
</tr>
</table>
</div>
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/comments.html' %}
{% include 'inc/panels/image_attachments.html' %}
{% plugin_left_page object %}
</div> </div>
<div class="col col-12 col-xl-7"> <div class="col col-12 col-xl-7">
<div class="text-end mb-4"> <div class="text-end mb-4">
@ -168,26 +120,26 @@
</select> </select>
</div> </div>
<div class="row" style="margin-bottom: 20px"> <div class="row" style="margin-bottom: 20px">
<div class="col col-md-6 col-sm-6 col-xs-12 text-center"> <div class="col col-md-6 col-sm-6 col-xs-12 text-center">
<div style="margin-left: 30px"> <div style="margin-left: 30px">
<h4>{% trans "Front" %}</h4> <h4>{% trans "Front" %}</h4>
{% include 'dcim/inc/rack_elevation.html' with face='front' extra_params=svg_extra %} {% include 'dcim/inc/rack_elevation.html' with face='front' extra_params=svg_extra %}
</div>
</div> </div>
<div class="col col-md-6 col-sm-6 col-xs-12 text-center"> </div>
<div style="margin-left: 30px"> <div class="col col-md-6 col-sm-6 col-xs-12 text-center">
<h4>{% trans "Rear" %}</h4> <div style="margin-left: 30px">
{% include 'dcim/inc/rack_elevation.html' with face='rear' extra_params=svg_extra %} <h4>{% trans "Rear" %}</h4>
</div> {% include 'dcim/inc/rack_elevation.html' with face='rear' extra_params=svg_extra %}
</div> </div>
</div>
</div> </div>
{% include 'inc/panels/related_objects.html' %} {% include 'inc/panels/related_objects.html' %}
{% plugin_right_page object %} {% plugin_right_page object %}
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col col-md-12"> <div class="col col-md-12">
{% plugin_full_width_page object %} {% plugin_full_width_page object %}
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -20,63 +20,22 @@
<th scope="row">{% trans "Name" %}</th> <th scope="row">{% trans "Name" %}</th>
<td>{{ object.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr>
<th scope="row">{% trans "Form factor" %}</th>
<td>{{ object.get_form_factor_display|placeholder }}</td>
</tr>
<tr> <tr>
<th scope="row">{% trans "Description" %}</th> <th scope="row">{% trans "Description" %}</th>
<td>{{ object.description|placeholder }}</td> <td>{{ object.description|placeholder }}</td>
</tr> </tr>
</table> </table>
</div> </div>
{% include 'dcim/inc/panels/racktype_dimensions.html' %}
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/comments.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-6">
{% include 'dcim/inc/panels/racktype_numbering.html' %}
<div class="card"> <div class="card">
<h5 class="card-header">{% trans "Dimensions" %}</h5> <h5 class="card-header">{% trans "Weight" %}</h5>
<table class="table table-hover attr-table"> <table class="table table-hover attr-table">
<tr>
<th scope="row">{% trans "Width" %}</th>
<td>{{ object.get_width_display }}</td>
</tr>
<tr>
<th scope="row">{% trans "Height" %}</th>
<td>{{ object.u_height }}U ({% if object.desc_units %}{% trans "descending" %}{% else %}{% trans "ascending" %}{% endif %})</td>
</tr>
<tr>
<th scope="row">{% trans "Starting Unit" %}</th>
<td>
{{ object.starting_unit }}
</td>
</tr>
<tr>
<th scope="row">{% trans "Outer Width" %}</th>
<td>
{% if object.outer_width %}
{{ object.outer_width }} {{ object.get_outer_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Outer Depth" %}</th>
<td>
{% if object.outer_depth %}
{{ object.outer_depth }} {{ object.get_outer_unit_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Mounting Depth" %}</th>
<td>
{% if object.mounting_depth %}
{{ object.mounting_depth }} {% trans "Millimeters" %}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr> <tr>
<th scope="row">{% trans "Rack Weight" %}</th> <th scope="row">{% trans "Rack Weight" %}</th>
<td> <td>
@ -99,11 +58,6 @@
</tr> </tr>
</table> </table>
</div> </div>
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/comments.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-6">
{% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/related_objects.html' %} {% include 'inc/panels/related_objects.html' %}
{% plugin_right_page object %} {% plugin_right_page object %}