Fix null cable termination representation

This commit is contained in:
jeremystretch 2022-07-25 11:34:16 -04:00
parent 12476036cd
commit 2583abc39d

View File

@ -1,58 +1,62 @@
{% load helpers %} {% load helpers %}
<table class="table table-hover panel-body attr-table"> {% if terminations.0 %}
{% if terminations.0.device %} <table class="table table-hover panel-body attr-table">
{# Device component #} {% if terminations.0.device %}
<tr> {# Device component #}
<td>Site</td> <tr>
<td>{{ terminations.0.device.site|linkify }}</td> <td>Site</td>
</tr> <td>{{ terminations.0.device.site|linkify }}</td>
<tr> </tr>
<td>Rack</td> <tr>
<td>{{ terminations.0.device.rack|linkify|placeholder }}</td> <td>Rack</td>
</tr> <td>{{ terminations.0.device.rack|linkify|placeholder }}</td>
<tr> </tr>
<td>Device</td> <tr>
<td>{{ terminations.0.device|linkify }}</td> <td>Device</td>
</tr> <td>{{ terminations.0.device|linkify }}</td>
<tr> </tr>
<td>{{ terminations.0|meta:"verbose_name"|capfirst }}</td> <tr>
<td> <td>{{ terminations.0|meta:"verbose_name"|capfirst }}</td>
{% for term in terminations %} <td>
{{ term|linkify }}{% if not forloop.last %},{% endif %} {% for term in terminations %}
{% endfor %} {{ term|linkify }}{% if not forloop.last %},{% endif %}
</td> {% endfor %}
</tr> </td>
{% elif terminations.0.power_panel %} </tr>
{# Power feed #} {% elif terminations.0.power_panel %}
<tr> {# Power feed #}
<td>Site</td> <tr>
<td>{{ terminations.0.power_panel.site|linkify }}</td> <td>Site</td>
</tr> <td>{{ terminations.0.power_panel.site|linkify }}</td>
<tr> </tr>
<td>Power Panel</td> <tr>
<td>{{ terminations.0.power_panel|linkify }}</td> <td>Power Panel</td>
</tr> <td>{{ terminations.0.power_panel|linkify }}</td>
<tr> </tr>
<td>{{ terminations.0|meta:"verbose_name"|capfirst }}</td> <tr>
<td> <td>{{ terminations.0|meta:"verbose_name"|capfirst }}</td>
{% for term in terminations %} <td>
{{ term|linkify }}{% if not forloop.last %},{% endif %} {% for term in terminations %}
{% endfor %} {{ term|linkify }}{% if not forloop.last %},{% endif %}
</td> {% endfor %}
</tr> </td>
{% else %} </tr>
{# Circuit termination #} {% elif terminations.0.circuit %}
<tr> {# Circuit termination #}
<td>Provider</td> <tr>
<td>{{ terminations.0.circuit.provider|linkify }}</td> <td>Provider</td>
</tr> <td>{{ terminations.0.circuit.provider|linkify }}</td>
<tr> </tr>
<td>Circuit</td> <tr>
<td> <td>Circuit</td>
{% for term in terminations %} <td>
{{ term.circuit|linkify }} ({{ term }}){% if not forloop.last %},{% endif %} {% for term in terminations %}
{% endfor %} {{ term.circuit|linkify }} ({{ term }}){% if not forloop.last %},{% endif %}
</td> {% endfor %}
</tr> </td>
{% endif %} </tr>
</table> {% endif %}
</table>
{% else %}
<span class="text-muted">No termination</span>
{% endif %}