1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00
Files
netbox-community-netbox/netbox/utilities/templates/form_helpers/render_fieldset.html

64 lines
2.0 KiB
HTML

{% load i18n %}
{% load form_helpers %}
<div class="field-group mb-5">
{% if heading %}
<div class="row">
<h5 class="col-9 offset-3">{{ heading }}</h5>
</div>
{% endif %}
{% for layout, title, items in rows %}
{% if layout == 'field' %}
{# Single form field #}
{% render_field items.0 %}
{% elif layout == 'attribute' %}
{# A static attribute of the form's instance #}
<div class="row mb-3">
<label class="col-sm-3 col-form-label text-lg-end required">{{ title }}</label>
<div class="col">
<div class="form-control-plaintext">
{{ items.0|linkify }}
</div>
</div>
</div>
{% elif layout == 'inline' %}
{# Multiple form fields on the same line #}
<div class="row mb-3">
<label class="col col-form-label text-lg-end">{{ title|default:'' }}</label>
{% for field in items %}
<div class="col mb-1">
{{ field }}
<div class="form-text">{% trans field.label %}</div>
</div>
{% endfor %}
</div>
{% elif layout == 'tabs' %}
{# Tabbed groups of fields #}
<div class="row offset-sm-3">
<ul class="nav nav-pills mb-1" role="tablist">
{% for tab in items %}
<li role="presentation" class="nav-item">
<button role="tab" type="button" id="{{ tab.id }}_tab" data-bs-toggle="tab" aria-controls="{{ tab.id }}" data-bs-target="#{{ tab.id }}" class="nav-link {% if tab.active %}active{% endif %}">
{% trans tab.title %}
</button>
</li>
{% endfor %}
</ul>
</div>
<div class="tab-content p-0 border-0">
{% for tab in items %}
<div class="tab-pane {% if tab.active %}active{% endif %}" id="{{ tab.id }}" role="tabpanel" aria-labeled-by="{{ tab.id }}_tab">
{% for field in tab.fields %}
{% render_field field %}
{% endfor %}
</div>
{% endfor %}
</div>
{% endif %}
{% endfor %}
</div>