Remove obsolete content-wrapper template block

This commit is contained in:
Jeremy Stretch 2024-01-09 15:22:41 -05:00
parent 58628aa086
commit a88919c927
14 changed files with 638 additions and 669 deletions

View File

@ -23,8 +23,3 @@
</ul>
{% endblock %}
{% block content-wrapper %}
<div class="tab-content">
{% block content %}{% endblock %}
</div>
{% endblock %}

View File

@ -171,17 +171,13 @@ Blocks:
</div>
{# /Page header #}
{# Page body #}
{% block page %}
<div class="page-body">
<div class="container-xl tab-content py-3">
{# Page content #}
{# TODO: Remove content-wrapper block #}
{% block content-wrapper %}
{% block content %}{% endblock %}
{% endblock %}
{% block content %}{% endblock %}
{# /Page content #}
{# Bottom banner #}

View File

@ -5,8 +5,7 @@
{% block title %}{{ title }}{% endblock %}
{% block content-wrapper %}
<div class="tab-content">
{% block content %}
{# Connections list #}
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
@ -25,5 +24,4 @@
</div>
{% endif %}
</div>
{% endblock content-wrapper %}
{% endblock content %}

View File

@ -36,56 +36,54 @@
</div>
{% endblock %}
{% block content-wrapper %}
<div class="tab-content">
{% block content %}
{% if filter_form %}
{% applied_filters model filter_form request.GET %}
{% if filter_form %}
{% applied_filters model filter_form request.GET %}
{% endif %}
{# Rack elevations #}
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
{% if page %}
<div style="white-space: nowrap; overflow-x: scroll;">
{% for rack in page %}
<div style="display: inline-block; margin-right: 12px">
<div style="margin-left: 30px">
<div class="text-center">
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack.name }}</a></strong>
{% if rack.role %}
<br /><span class="badge my-3" style="color: {{ rack.role.color|fgcolor }}; background-color: #{{ rack.role.color }}">{{ rack.role }}</span>
{% endif %}
{% if rack.facility_id %}
<br /><small class="text-muted">{{ rack.facility_id }}</small>
{% endif %}
</div>
{% include 'dcim/inc/rack_elevation.html' with object=rack face=rack_face %}
<div class="clearfix"></div>
<div class="text-center">
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack.name }}</a></strong>
{% if rack.facility_id %}
<small class="text-muted">({{ rack.facility_id }})</small>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
<br />
{% include 'inc/paginator.html' %}
{% else %}
<p>{% trans "No Racks Found" %}</p>
{% endif %}
{# Rack elevations #}
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
{% if page %}
<div style="white-space: nowrap; overflow-x: scroll;">
{% for rack in page %}
<div style="display: inline-block; margin-right: 12px">
<div style="margin-left: 30px">
<div class="text-center">
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack.name }}</a></strong>
{% if rack.role %}
<br /><span class="badge my-3" style="color: {{ rack.role.color|fgcolor }}; background-color: #{{ rack.role.color }}">{{ rack.role }}</span>
{% endif %}
{% if rack.facility_id %}
<br /><small class="text-muted">{{ rack.facility_id }}</small>
{% endif %}
</div>
{% include 'dcim/inc/rack_elevation.html' with object=rack face=rack_face %}
<div class="clearfix"></div>
<div class="text-center">
<strong><a href="{% url 'dcim:rack' pk=rack.pk %}">{{ rack.name }}</a></strong>
{% if rack.facility_id %}
<small class="text-muted">({{ rack.facility_id }})</small>
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
<br />
{% include 'inc/paginator.html' %}
{% else %}
<p>{% trans "No Racks Found" %}</p>
{% endif %}
</div>
{# Filter form #}
{% if filter_form %}
<div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
{% include 'inc/filter_list.html' %}
</div>
{% endif %}
</div>
{% endblock content-wrapper %}
{# Filter form #}
{% if filter_form %}
<div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
{% include 'inc/filter_list.html' %}
</div>
{% endif %}
{% endblock content %}
{% block modals %}{% endblock %}

View File

@ -9,106 +9,104 @@
{% endblocktrans %}
{% endblock %}
{% block content-wrapper %}
<div class="tab-content">
<div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
<form action="" method="post" enctype="multipart/form-data" class="form-object-edit">
{% for form in formset %}
{% render_errors form %}
{% endfor %}
{% block content %}
<div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
<form action="" method="post" enctype="multipart/form-data" class="form-object-edit">
{% for form in formset %}
{% render_errors form %}
{% endfor %}
{% csrf_token %}
{{ pk_form.pk }}
{{ formset.management_form }}
<div class="field-group my-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Virtual Chassis" %}</h5>
</div>
{% render_field vc_form.name %}
{% render_field vc_form.domain %}
{% render_field vc_form.description %}
{% render_field vc_form.master %}
{% render_field vc_form.tags %}
{% csrf_token %}
{{ pk_form.pk }}
{{ formset.management_form }}
<div class="field-group my-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Virtual Chassis" %}</h5>
</div>
{% render_field vc_form.name %}
{% render_field vc_form.domain %}
{% render_field vc_form.description %}
{% render_field vc_form.master %}
{% render_field vc_form.tags %}
</div>
<div class="field-group my-5">
{% render_field vc_form.comments %}
</div>
{% if vc_form.custom_fields %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Custom Fields" %}</h5>
</div>
{% render_custom_fields vc_form %}
</div>
{% endif %}
<div class="field-group my-5">
{% render_field vc_form.comments %}
</div>
{% if vc_form.custom_fields %}
<div class="field-group mb-5">
<h5 class="text-center">{% trans "Members" %}</h5>
<table class="table">
<thead>
<tr>
<th>{% trans "Device" %}</th>
<th>{% trans "ID" %}</th>
<th>{% trans "Rack/Unit" %}</th>
<th>{% trans "Serial" %}</th>
<th>{% trans "Position" %}</th>
<th>{% trans "Priority" %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for form in formset %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% with device=form.instance virtual_chassis=vc_form.instance %}
<tr>
<td>{{ device|linkify }}</td>
<td>{{ device.pk }}</td>
<td>
{% if device.rack %}
{{ device.rack }} / {{ device.position|floatformat }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
<td>{{ device.serial|placeholder }}</td>
<td>
{{ form.vc_position }}
{% if form.vc_position.errors %}
<br /><small class="text-danger">{{ form.vc_position.errors.0 }}</small>
{% endif %}
</td>
<td>
{{ form.vc_priority }}
{% if form.vc_priority.errors %}
<br /><small class="text-danger">{{ form.vc_priority.errors.0 }}</small>
{% endif %}
</td>
<td>
{% if virtual_chassis.pk %}
<a href="{% url 'dcim:virtualchassis_remove_member' pk=device.pk %}?return_url={% url 'dcim:virtualchassis_edit' pk=virtual_chassis.pk %}" class="btn btn-danger{% if virtual_chassis.master == device %} disabled{% endif %}">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span>
</a>
{% endif %}
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
<div class="row">
<h5 class="col-9 offset-3">{% trans "Custom Fields" %}</h5>
</div>
{% render_custom_fields vc_form %}
</div>
<div class="text-end">
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
{% if vc_form.instance.pk %}
<button type="submit" name="_update" class="btn btn-primary">{% trans "Save" %}</button>
{% else %}
<button type="submit" name="_create" class="btn btn-primary">{% trans "Create" %}</button>
{% endif %}
</div>
</form>
</div>
{% endif %}
<div class="field-group mb-5">
<h5 class="text-center">{% trans "Members" %}</h5>
<table class="table">
<thead>
<tr>
<th>{% trans "Device" %}</th>
<th>{% trans "ID" %}</th>
<th>{% trans "Rack/Unit" %}</th>
<th>{% trans "Serial" %}</th>
<th>{% trans "Position" %}</th>
<th>{% trans "Priority" %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for form in formset %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% with device=form.instance virtual_chassis=vc_form.instance %}
<tr>
<td>{{ device|linkify }}</td>
<td>{{ device.pk }}</td>
<td>
{% if device.rack %}
{{ device.rack }} / {{ device.position|floatformat }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
<td>{{ device.serial|placeholder }}</td>
<td>
{{ form.vc_position }}
{% if form.vc_position.errors %}
<br /><small class="text-danger">{{ form.vc_position.errors.0 }}</small>
{% endif %}
</td>
<td>
{{ form.vc_priority }}
{% if form.vc_priority.errors %}
<br /><small class="text-danger">{{ form.vc_priority.errors.0 }}</small>
{% endif %}
</td>
<td>
{% if virtual_chassis.pk %}
<a href="{% url 'dcim:virtualchassis_remove_member' pk=device.pk %}?return_url={% url 'dcim:virtualchassis_edit' pk=virtual_chassis.pk %}" class="btn btn-danger{% if virtual_chassis.master == device %} disabled{% endif %}">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span>
</a>
{% endif %}
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
<div class="text-end">
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
{% if vc_form.instance.pk %}
<button type="submit" name="_update" class="btn btn-primary">{% trans "Save" %}</button>
{% else %}
<button type="submit" name="_create" class="btn btn-primary">{% trans "Create" %}</button>
{% endif %}
</div>
</form>
</div>
{% endblock %}
{% endblock content %}

View File

@ -3,9 +3,9 @@
{% block title %}{% trans "Change Log" %}{% endblock %}
{% block content-wrapper %}
{% block content %}
{{ block.super }}
<div class="text-muted px-3">
{% trans "Change log retention" %}: {% if config.CHANGELOG_RETENTION %}{{ config.CHANGELOG_RETENTION }} {% trans "days" %}{% else %}{% trans "Indefinite" %}{% endif %}
</div>
{% endblock %}
{% endblock content %}

View File

@ -23,113 +23,111 @@
</div>
{% endblock controls %}
{% block content-wrapper %}
<div class="tab-content">
{% for module in report_modules %}
<div class="card">
<h5 class="card-header" id="module{{ module.pk }}">
{% if perms.extras.delete_reportmodule %}
<div class="float-end">
<a href="{% url 'extras:reportmodule_delete' pk=module.pk %}" class="btn btn-danger">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete" %}
</a>
</div>
{% endif %}
<i class="mdi mdi-file-document-outline"></i> {{ module }}
</h5>
<div class="card-body">
{% include 'inc/sync_warning.html' with object=module %}
{% if module.reports %}
<table class="table table-hover table-headings reports">
<thead>
<tr>
<th width="250">{% trans "Name" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Last Run" %}</th>
<th>{% trans "Status" %}</th>
<th width="120"></th>
</tr>
</thead>
<tbody>
{% with jobs=module.get_latest_jobs %}
{% for report_name, report in module.reports.items %}
{% with last_job=jobs|get_key:report.class_name %}
<tr>
{% block content %}
{% for module in report_modules %}
<div class="card">
<h5 class="card-header" id="module{{ module.pk }}">
{% if perms.extras.delete_reportmodule %}
<div class="float-end">
<a href="{% url 'extras:reportmodule_delete' pk=module.pk %}" class="btn btn-danger">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete" %}
</a>
</div>
{% endif %}
<i class="mdi mdi-file-document-outline"></i> {{ module }}
</h5>
<div class="card-body">
{% include 'inc/sync_warning.html' with object=module %}
{% if module.reports %}
<table class="table table-hover table-headings reports">
<thead>
<tr>
<th width="250">{% trans "Name" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Last Run" %}</th>
<th>{% trans "Status" %}</th>
<th width="120"></th>
</tr>
</thead>
<tbody>
{% with jobs=module.get_latest_jobs %}
{% for report_name, report in module.reports.items %}
{% with last_job=jobs|get_key:report.class_name %}
<tr>
<td>
<a href="{% url 'extras:report' module=module.python_name name=report.class_name %}" id="{{ report.module }}.{{ report.class_name }}">{{ report.name }}</a>
</td>
<td>{{ report.description|markdown|placeholder }}</td>
{% if last_job %}
<td>
<a href="{% url 'extras:report' module=module.python_name name=report.class_name %}" id="{{ report.module }}.{{ report.class_name }}">{{ report.name }}</a>
<a href="{% url 'extras:report_result' job_pk=last_job.pk %}">{{ last_job.created|annotated_date }}</a>
</td>
<td>{{ report.description|markdown|placeholder }}</td>
{% if last_job %}
<td>
<a href="{% url 'extras:report_result' job_pk=last_job.pk %}">{{ last_job.created|annotated_date }}</a>
</td>
<td>
{% badge last_job.get_status_display last_job.get_status_color %}
</td>
{% else %}
<td class="text-muted">{% trans "Never" %}</td>
<td>
{% if report.is_valid %}
{{ ''|placeholder }}
{% else %}
<span class="badge text-bg-danger" title="{% trans "Report has no test methods" %}">
{% trans "Invalid" %}
</span>
{% endif %}
</td>
{% endif %}
<td>
{% if perms.extras.run_report and report.is_valid %}
<div class="float-end noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %}
<button type="submit" name="_run" class="btn btn-primary" style="width: 110px">
{% if last_job %}
<i class="mdi mdi-replay"></i> {% trans "Run Again" %}
{% else %}
<i class="mdi mdi-play"></i> {% trans "Run Report" %}
{% endif %}
</button>
</form>
</div>
{% badge last_job.get_status_display last_job.get_status_color %}
</td>
{% else %}
<td class="text-muted">{% trans "Never" %}</td>
<td>
{% if report.is_valid %}
{{ ''|placeholder }}
{% else %}
<span class="badge text-bg-danger" title="{% trans "Report has no test methods" %}">
{% trans "Invalid" %}
</span>
{% endif %}
</td>
{% endif %}
<td>
{% if perms.extras.run_report and report.is_valid %}
<div class="float-end noprint">
<form action="{% url 'extras:report' module=report.module name=report.class_name %}" method="post">
{% csrf_token %}
<button type="submit" name="_run" class="btn btn-primary" style="width: 110px">
{% if last_job %}
<i class="mdi mdi-replay"></i> {% trans "Run Again" %}
{% else %}
<i class="mdi mdi-play"></i> {% trans "Run Report" %}
{% endif %}
</button>
</form>
</div>
{% endif %}
</td>
</tr>
{% for method, stats in last_job.data.items %}
<tr>
<td colspan="4" class="method">
<span class="ps-3">{{ method }}</span>
</td>
<td class="text-end text-nowrap report-stats">
<span class="badge text-bg-success">{{ stats.success }}</span>
<span class="badge text-bg-info">{{ stats.info }}</span>
<span class="badge text-bg-warning">{{ stats.warning }}</span>
<span class="badge text-bg-danger">{{ stats.failure }}</span>
</td>
</tr>
{% for method, stats in last_job.data.items %}
<tr>
<td colspan="4" class="method">
<span class="ps-3">{{ method }}</span>
</td>
<td class="text-end text-nowrap report-stats">
<span class="badge text-bg-success">{{ stats.success }}</span>
<span class="badge text-bg-info">{{ stats.info }}</span>
<span class="badge text-bg-warning">{{ stats.warning }}</span>
<span class="badge text-bg-danger">{{ stats.failure }}</span>
</td>
</tr>
{% endfor %}
{% endwith %}
{% endfor %}
{% endwith %}
</tbody>
</table>
{% else %}
<div class="alert alert-warning" role="alert">
<i class="mdi mdi-alert"></i> Could not load reports from {{ module.name }}
</div>
{% endif %}
</div>
</div>
{% empty %}
<div class="alert alert-info" role="alert">
<h4 class="alert-heading">{% trans "No Reports Found" %}</h4>
{% if perms.extras.add_reportmodule %}
{% url 'extras:reportmodule_add' as create_report_url %}
{% blocktrans trimmed %}
Get started by <a href="{{ create_report_url }}">creating a report</a> from an uploaded file or data source.
{% endblocktrans %}
{% endfor %}
{% endwith %}
{% endfor %}
{% endwith %}
</tbody>
</table>
{% else %}
<div class="alert alert-warning" role="alert">
<i class="mdi mdi-alert"></i> Could not load reports from {{ module.name }}
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endblock content-wrapper %}
</div>
{% empty %}
<div class="alert alert-info" role="alert">
<h4 class="alert-heading">{% trans "No Reports Found" %}</h4>
{% if perms.extras.add_reportmodule %}
{% url 'extras:reportmodule_add' as create_report_url %}
{% blocktrans trimmed %}
Get started by <a href="{{ create_report_url }}">creating a report</a> from an uploaded file or data source.
{% endblocktrans %}
{% endif %}
</div>
{% endfor %}
{% endblock content %}

View File

@ -2,13 +2,13 @@
{% load buttons %}
{% load perms %}
{% block content-wrapper %}
<div class="row p-3">
{% block content %}
<div class="row">
<div class="col col-md-12"{% if not job.completed %} hx-get="{% url 'extras:report_result' job_pk=job.pk %}" hx-trigger="load delay:0.5s, every 5s"{% endif %}>
{% include 'extras/htmx/report_result.html' %}
</div>
</div>
{% endblock %}
{% endblock content %}
{% block controls %}
<div class="controls">

View File

@ -22,80 +22,78 @@
</ul>
{% endblock tabs %}
{% block content-wrapper %}
<div class="tab-content">
{% for module in script_modules %}
<div class="card">
<h5 class="card-header" id="module{{ module.pk }}">
{% if perms.extras.delete_scriptmodule %}
<div class="float-end">
<a href="{% url 'extras:scriptmodule_delete' pk=module.pk %}" class="btn btn-danger">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete" %}
</a>
</div>
{% endif %}
<i class="mdi mdi-file-document-outline"></i> {{ module }}
</h5>
<div class="card-body">
{% include 'inc/sync_warning.html' with object=module %}
{% if not module.scripts %}
<div class="alert alert-warning d-flex align-items-center" role="alert">
<i class="mdi mdi-alert"></i>
{% blocktrans trimmed with file_path=module.full_path %}
Script file at <code class="mx-1">{{ file_path }}</code> could not be loaded.
{% endblocktrans %}
</div>
{% else %}
<table class="table table-hover table-headings reports">
<thead>
<tr>
<th width="250">{% trans "Name" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Last Run" %}</th>
<th class="text-end">{% trans "Status" %}</th>
</tr>
</thead>
<tbody>
{% with jobs=module.get_latest_jobs %}
{% for script_name, script_class in module.scripts.items %}
<tr>
<td>
<a href="{% url 'extras:script' module=module.python_name name=script_name %}" name="script.{{ script_name }}">{{ script_class.name }}</a>
</td>
<td>
{{ script_class.Meta.description|markdown|placeholder }}
</td>
{% with last_result=jobs|get_key:script_class.class_name %}
{% if last_result %}
<td>
<a href="{% url 'extras:script_result' job_pk=last_result.pk %}">{{ last_result.created|annotated_date }}</a>
</td>
<td class="text-end">
{% badge last_result.get_status_display last_result.get_status_color %}
</td>
{% else %}
<td class="text-muted">{% trans "Never" %}</td>
<td class="text-end">{{ ''|placeholder }}</td>
{% endif %}
{% endwith %}
</tr>
{% endfor %}
{% endwith %}
</tbody>
</table>
{% endif %}
</div>
</div>
{% empty %}
<div class="alert alert-info">
<h4 class="alert-heading">{% trans "No Scripts Found" %}</h4>
{% if perms.extras.add_scriptmodule %}
{% url 'extras:scriptmodule_add' as create_script_url %}
{% blocktrans trimmed %}
Get started by <a href="{{ create_script_url }}">creating a script</a> from an uploaded file or data source.
{% endblocktrans %}
{% block content %}
{% for module in script_modules %}
<div class="card">
<h5 class="card-header" id="module{{ module.pk }}">
{% if perms.extras.delete_scriptmodule %}
<div class="float-end">
<a href="{% url 'extras:scriptmodule_delete' pk=module.pk %}" class="btn btn-danger">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete" %}
</a>
</div>
{% endif %}
<i class="mdi mdi-file-document-outline"></i> {{ module }}
</h5>
<div class="card-body">
{% include 'inc/sync_warning.html' with object=module %}
{% if not module.scripts %}
<div class="alert alert-warning d-flex align-items-center" role="alert">
<i class="mdi mdi-alert"></i>
{% blocktrans trimmed with file_path=module.full_path %}
Script file at <code class="mx-1">{{ file_path }}</code> could not be loaded.
{% endblocktrans %}
</div>
{% else %}
<table class="table table-hover table-headings reports">
<thead>
<tr>
<th width="250">{% trans "Name" %}</th>
<th>{% trans "Description" %}</th>
<th>{% trans "Last Run" %}</th>
<th class="text-end">{% trans "Status" %}</th>
</tr>
</thead>
<tbody>
{% with jobs=module.get_latest_jobs %}
{% for script_name, script_class in module.scripts.items %}
<tr>
<td>
<a href="{% url 'extras:script' module=module.python_name name=script_name %}" name="script.{{ script_name }}">{{ script_class.name }}</a>
</td>
<td>
{{ script_class.Meta.description|markdown|placeholder }}
</td>
{% with last_result=jobs|get_key:script_class.class_name %}
{% if last_result %}
<td>
<a href="{% url 'extras:script_result' job_pk=last_result.pk %}">{{ last_result.created|annotated_date }}</a>
</td>
<td class="text-end">
{% badge last_result.get_status_display last_result.get_status_color %}
</td>
{% else %}
<td class="text-muted">{% trans "Never" %}</td>
<td class="text-end">{{ ''|placeholder }}</td>
{% endif %}
{% endwith %}
</tr>
{% endfor %}
{% endwith %}
</tbody>
</table>
{% endif %}
</div>
{% endfor %}
</div>
{% endblock content-wrapper %}
</div>
{% empty %}
<div class="alert alert-info">
<h4 class="alert-heading">{% trans "No Scripts Found" %}</h4>
{% if perms.extras.add_scriptmodule %}
{% url 'extras:scriptmodule_add' as create_script_url %}
{% blocktrans trimmed %}
Get started by <a href="{{ create_script_url }}">creating a script</a> from an uploaded file or data source.
{% endblocktrans %}
{% endif %}
</div>
{% endfor %}
{% endblock content %}

View File

@ -36,7 +36,7 @@
</div>
{% endblock controls %}
{% block content-wrapper %}
{% block tabs %}
<ul class="nav nav-tabs px-3" role="tablist">
<li class="nav-item" role="presentation">
<a href="#log" role="tab" data-bs-toggle="tab" class="nav-link active">{% trans "Log" %}</a>
@ -45,20 +45,21 @@
<a href="#source" role="tab" data-bs-toggle="tab" class="nav-link">{% trans "Source" %}</a>
</li>
</ul>
<div class="tab-content mb-3">
<div role="tabpanel" class="tab-pane active" id="log">
<div class="row">
<div class="col col-md-12"{% if not job.completed %} hx-get="{% url 'extras:script_result' job_pk=job.pk %}" hx-trigger="load delay:0.5s, every 5s"{% endif %}>
{% include 'extras/htmx/script_result.html' %}
</div>
{% endblock %}
{% block content %}
<div role="tabpanel" class="tab-pane active" id="log">
<div class="row">
<div class="col col-md-12"{% if not job.completed %} hx-get="{% url 'extras:script_result' job_pk=job.pk %}" hx-trigger="load delay:0.5s, every 5s"{% endif %}>
{% include 'extras/htmx/script_result.html' %}
</div>
</div>
<div role="tabpanel" class="tab-pane" id="source">
<p><code>{{ script.filename }}</code></p>
<pre class="block">{{ script.source }}</pre>
</div>
</div>
{% endblock content-wrapper %}
<div role="tabpanel" class="tab-pane" id="source">
<p><code>{{ script.filename }}</code></p>
<pre class="block">{{ script.source }}</pre>
</div>
{% endblock content %}
{% block modals %}
{% include 'inc/htmx_modal.html' %}

View File

@ -24,53 +24,49 @@
</ul>
{% endblock %}
{% block content-wrapper %}
<div class="tab-content">
{% block content %}
{% block content %}
{# Component creation form #}
<div class="tab-pane show active" id="component-form" role="tabpanel" aria-labelledby="component-form-tab">
<form action="" method="post" class="form form-horizontal">
{# Component creation form #}
<div class="tab-pane show active" id="component-form" role="tabpanel" aria-labelledby="component-form-tab">
<form action="" method="post" class="form form-horizontal">
{% csrf_token %}
{% if request.POST.return_url %}
<input type="hidden" name="return_url" value="{{ request.POST.return_url }}" />
{% endif %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% csrf_token %}
{% if request.POST.return_url %}
<input type="hidden" name="return_url" value="{{ request.POST.return_url }}" />
{% endif %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
<div class="row">
<div class="col col-md-12 col-lg-10 offset-lg-1">
<div class="card">
<h5 class="card-header">{{ model_name|title }} {% trans "to Add" %}</h5>
<div class="card-body">
{% for field in form.visible_fields %}
{% render_field field %}
{% endfor %}
</div>
</div>
<div class="form-group text-end">
<div class="col col-md-12">
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
<button type="submit" name="_create" class="btn btn-primary">{% trans "Create" %}</button>
</div>
</div>
<div class="row">
<div class="col col-md-12 col-lg-10 offset-lg-1">
<div class="card">
<h5 class="card-header">{{ model_name|title }} {% trans "to Add" %}</h5>
<div class="card-body">
{% for field in form.visible_fields %}
{% render_field field %}
{% endfor %}
</div>
</div>
</form>
</div>
{# Selected objects list #}
<div class="tab-pane" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
<div class="card">
<div class="card-body table-responsive">
{% render_table table 'inc/table.html' %}
<div class="form-group text-end">
<div class="col col-md-12">
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
<button type="submit" name="_create" class="btn btn-primary">{% trans "Create" %}</button>
</div>
</div>
</div>
</div>
{% endblock %}
</form>
</div>
{% endblock %}
{# Selected objects list #}
<div class="tab-pane" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
<div class="card">
<div class="card-body table-responsive">
{% render_table table 'inc/table.html' %}
</div>
</div>
</div>
{% endblock content %}

View File

@ -32,105 +32,101 @@ Context:
</ul>
{% endblock tabs %}
{% block content-wrapper %}
<div class="tab-content">
{% block content %}
{% block content %}
{# Edit form #}
<div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="edit-form-tab">
<form action="" method="post" class="form form-horizontal mt-5">
{# Edit form #}
<div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="edit-form-tab">
<form action="" method="post" class="form form-horizontal mt-5">
{% csrf_token %}
{% if request.POST.return_url %}
<input type="hidden" name="return_url" value="{{ request.POST.return_url }}" />
{% endif %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% csrf_token %}
{% if request.POST.return_url %}
<input type="hidden" name="return_url" value="{{ request.POST.return_url }}" />
{% endif %}
{% for field in form.hidden_fields %}
{{ field }}
{% endfor %}
{% if form.fieldsets %}
{% if form.fieldsets %}
{# Render grouped fields according to declared fieldsets #}
{% for group, fields in form.fieldsets %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">
{% if group %}{{ group }}{% else %}{{ model|meta:"verbose_name"|bettertitle }}{% endif %}
</h5>
</div>
{% for name in fields %}
{% with field=form|getfield:name %}
{% if field.name in form.nullable_fields %}
{% render_field field bulk_nullable=True %}
{% else %}
{% render_field field %}
{% endif %}
{% endwith %}
{% endfor %}
</div>
{# Render grouped fields according to declared fieldsets #}
{% for group, fields in form.fieldsets %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">
{% if group %}{{ group }}{% else %}{{ model|meta:"verbose_name"|bettertitle }}{% endif %}
</h5>
</div>
{% for name in fields %}
{% with field=form|getfield:name %}
{% if field.name in form.nullable_fields %}
{% render_field field bulk_nullable=True %}
{% else %}
{% render_field field %}
{% endif %}
{% endwith %}
{% endfor %}
</div>
{% endfor %}
{# Render tag add/remove fields #}
{% if form.add_tags and form.remove_tags %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Tags" %}</h5>
</div>
{% render_field form.add_tags %}
{% render_field form.remove_tags %}
</div>
{% endif %}
{# Render tag add/remove fields #}
{% if form.add_tags and form.remove_tags %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Tags" %}</h5>
</div>
{% render_field form.add_tags %}
{% render_field form.remove_tags %}
</div>
{% endif %}
{# Render custom fields #}
{% if form.custom_fields %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Custom Fields" %}</h5>
</div>
{% render_custom_fields form %}
</div>
{% endif %}
{# Render custom fields #}
{% if form.custom_fields %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Custom Fields" %}</h5>
</div>
{% render_custom_fields form %}
</div>
{% endif %}
{# Render comments #}
{% if form.comments %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Comments" %}</h5>
</div>
{% render_field form.comments bulk_nullable=True %}
</div>
{% endif %}
{# Render comments #}
{% if form.comments %}
<div class="field-group mb-5">
<div class="row">
<h5 class="col-9 offset-3">{% trans "Comments" %}</h5>
</div>
{% render_field form.comments bulk_nullable=True %}
</div>
{% endif %}
{% else %}
{# Render all fields #}
{% for field in form.visible_fields %}
{% if field.name in form.nullable_fields %}
{% render_field field bulk_nullable=True %}
{% else %}
{# Render all fields #}
{% for field in form.visible_fields %}
{% if field.name in form.nullable_fields %}
{% render_field field bulk_nullable=True %}
{% else %}
{% render_field field %}
{% endif %}
{% endfor %}
{% render_field field %}
{% endif %}
{% endfor %}
<div class="text-end">
<button type="submit" name="_apply" class="btn btn-primary">{% trans "Apply" %}</button>
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
</div>
{% endif %}
</form>
<div class="text-end">
<button type="submit" name="_apply" class="btn btn-primary">{% trans "Apply" %}</button>
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
</div>
{# Selected objects list #}
<div class="tab-pane" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
<div class="card">
<div class="card-body table-responsive">
{% render_table table 'inc/table.html' %}
</div>
</div>
</div>
{% endblock content %}
</form>
</div>
{% endblock content-wrapper %}
{# Selected objects list #}
<div class="tab-pane" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
<div class="card">
<div class="card-body table-responsive">
{% render_table table 'inc/table.html' %}
</div>
</div>
</div>
{% endblock content %}

View File

@ -33,44 +33,21 @@ Context:
</ul>
{% endblock tabs %}
{% block content-wrapper %}
<div class="tab-content">
{% block content %}
{# Data Import Form #}
<div class="tab-pane show active" id="import-form" role="tabpanel" aria-labelledby="import-form-tab">
<div class="row">
<div class="col col-md-12 col-lg-10 offset-lg-1">
<form action="" method="post" enctype="multipart/form-data" class="form">
{% csrf_token %}
<input type="hidden" name="import_method" value="direct" />
{% render_field form.data %}
{% render_field form.format %}
{% render_field form.csv_delimiter %}
<div class="form-group">
<div class="col col-md-12 text-end">
<button type="submit" name="data_submit" class="btn btn-primary">{% trans "Submit" %}</button>
{% if return_url %}
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
</div>
{# File Upload Form #}
<div class="tab-pane show" id="upload-form" role="tabpanel" aria-labelledby="upload-form-tab">
{# Data Import Form #}
<div class="tab-pane show active" id="import-form" role="tabpanel" aria-labelledby="import-form-tab">
<div class="row">
<div class="col col-md-12 col-lg-10 offset-lg-1">
<form action="" method="post" enctype="multipart/form-data" class="form">
{% csrf_token %}
<input type="hidden" name="import_method" value="upload" />
{% render_field form.upload_file %}
<input type="hidden" name="import_method" value="direct" />
{% render_field form.data %}
{% render_field form.format %}
{% render_field form.csv_delimiter %}
<div class="form-group">
<div class="col col-md-12 text-end">
<button type="submit" name="file_submit" class="btn btn-primary">{% trans "Submit" %}</button>
<button type="submit" name="data_submit" class="btn btn-primary">{% trans "Submit" %}</button>
{% if return_url %}
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
{% endif %}
@ -79,130 +56,151 @@ Context:
</form>
</div>
</div>
{# DataFile Form #}
<div class="tab-pane show" id="datafile-form" role="tabpanel" aria-labelledby="datafile-form-tab">
<div class="col col-md-12 col-lg-10 offset-lg-1">
<form action="" method="post" enctype="multipart/form-data" class="form">
{% csrf_token %}
<input type="hidden" name="import_method" value="datafile" />
{% render_field form.data_source %}
{% render_field form.data_file %}
{% render_field form.format %}
{% render_field form.csv_delimiter %}
<div class="form-group">
<div class="col col-md-12 text-end">
<button type="submit" name="file_submit" class="btn btn-primary">{% trans "Submit" %}</button>
{% if return_url %}
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
{% if fields %}
<div class="row my-3">
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">
{% trans "Field Options" %}
</h5>
<div class="card-body">
<table class="table">
<tr>
<th>{% trans "Field" %}</th>
<th>{% trans "Required" %}</th>
<th>{% trans "Accessor" %}</th>
<th>{% trans "Description" %}</th>
</tr>
{% for name, field in fields.items %}
<tr>
<td>
<code>{% if field.required %}<strong>{% endif %}{{ name }}{% if field.required %}</strong>{% endif %}</code>
</td>
<td>
{% if field.required %}
{% checkmark True true="Required" %}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
<td>
{% if field.to_field_name %}
<code>{{ field.to_field_name }}</code>
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
<td>
{% if field.STATIC_CHOICES %}
<button type="button" class="btn btn-link float-end" data-bs-toggle="modal" data-bs-target="#{{ name }}_choices">
<i class="mdi mdi-help-circle"></i>
</button>
<div class="modal fade" id="{{ name }}_choices" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><code>{{ name }}</code> {% trans "Choices" %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table table-striped">
<tr>
<th>{% trans "Import Value" %}</th>
<th>{% trans "Label" %}</th>
</tr>
{% for value, label in field.choices %}
{% if value %}
<tr>
<td>
<samp>{{ value }}</samp>
</td>
<td>
{{ label }}
</td>
</tr>
{% endif %}
{% endfor %}
</table>
</div>
</div>
</div>
</div>
{% endif %}
{% if field.help_text %}
{{ field.help_text }}<br />
{% elif field.label %}
{{ field.label }}<br />
{% endif %}
{% if field|widget_type == 'dateinput' %}
<small class="text-muted">{% trans "Format: YYYY-MM-DD" %}</small>
{% elif field|widget_type == 'checkboxinput' %}
<small class="text-muted">{% trans "Specify true or false" %}</small>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
</div>
<p class="small text-muted">
<i class="mdi mdi-check-bold text-success"></i>
{% blocktrans trimmed %}
Required fields <strong>must</strong> be specified for all objects.
{% endblocktrans %}
</p>
<p class="small text-muted">
<i class="mdi mdi-information-outline"></i>
{% blocktrans trimmed with example="vrf.rd" %}
Related objects may be referenced by any unique attribute. For example, <code>{{ example }}</code> would identify a VRF by its route distinguisher.
{% endblocktrans %}
</p>
{% endif %}
</div>
{% endblock content-wrapper %}
{# File Upload Form #}
<div class="tab-pane show" id="upload-form" role="tabpanel" aria-labelledby="upload-form-tab">
<div class="col col-md-12 col-lg-10 offset-lg-1">
<form action="" method="post" enctype="multipart/form-data" class="form">
{% csrf_token %}
<input type="hidden" name="import_method" value="upload" />
{% render_field form.upload_file %}
{% render_field form.format %}
{% render_field form.csv_delimiter %}
<div class="form-group">
<div class="col col-md-12 text-end">
<button type="submit" name="file_submit" class="btn btn-primary">{% trans "Submit" %}</button>
{% if return_url %}
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
{# DataFile Form #}
<div class="tab-pane show" id="datafile-form" role="tabpanel" aria-labelledby="datafile-form-tab">
<div class="col col-md-12 col-lg-10 offset-lg-1">
<form action="" method="post" enctype="multipart/form-data" class="form">
{% csrf_token %}
<input type="hidden" name="import_method" value="datafile" />
{% render_field form.data_source %}
{% render_field form.data_file %}
{% render_field form.format %}
{% render_field form.csv_delimiter %}
<div class="form-group">
<div class="col col-md-12 text-end">
<button type="submit" name="file_submit" class="btn btn-primary">{% trans "Submit" %}</button>
{% if return_url %}
<a href="{{ return_url }}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
{% endif %}
</div>
</div>
</form>
</div>
</div>
{% if fields %}
<div class="row my-3">
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">
{% trans "Field Options" %}
</h5>
<div class="card-body">
<table class="table">
<tr>
<th>{% trans "Field" %}</th>
<th>{% trans "Required" %}</th>
<th>{% trans "Accessor" %}</th>
<th>{% trans "Description" %}</th>
</tr>
{% for name, field in fields.items %}
<tr>
<td>
<code>{% if field.required %}<strong>{% endif %}{{ name }}{% if field.required %}</strong>{% endif %}</code>
</td>
<td>
{% if field.required %}
{% checkmark True true="Required" %}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
<td>
{% if field.to_field_name %}
<code>{{ field.to_field_name }}</code>
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
<td>
{% if field.STATIC_CHOICES %}
<button type="button" class="btn btn-link float-end" data-bs-toggle="modal" data-bs-target="#{{ name }}_choices">
<i class="mdi mdi-help-circle"></i>
</button>
<div class="modal fade" id="{{ name }}_choices" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><code>{{ name }}</code> {% trans "Choices" %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<table class="table table-striped">
<tr>
<th>{% trans "Import Value" %}</th>
<th>{% trans "Label" %}</th>
</tr>
{% for value, label in field.choices %}
{% if value %}
<tr>
<td>
<samp>{{ value }}</samp>
</td>
<td>
{{ label }}
</td>
</tr>
{% endif %}
{% endfor %}
</table>
</div>
</div>
</div>
</div>
{% endif %}
{% if field.help_text %}
{{ field.help_text }}<br />
{% elif field.label %}
{{ field.label }}<br />
{% endif %}
{% if field|widget_type == 'dateinput' %}
<small class="text-muted">{% trans "Format: YYYY-MM-DD" %}</small>
{% elif field|widget_type == 'checkboxinput' %}
<small class="text-muted">{% trans "Specify true or false" %}</small>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
</div>
<p class="small text-muted">
<i class="mdi mdi-check-bold text-success"></i>
{% blocktrans trimmed %}
Required fields <strong>must</strong> be specified for all objects.
{% endblocktrans %}
</p>
<p class="small text-muted">
<i class="mdi mdi-information-outline"></i>
{% blocktrans trimmed with example="vrf.rd" %}
Related objects may be referenced by any unique attribute. For example, <code>{{ example }}</code> would identify a VRF by its route distinguisher.
{% endblocktrans %}
</p>
{% endif %}
{% endblock content %}

View File

@ -45,46 +45,43 @@ Context:
</ul>
{% endblock tabs %}
{% block content-wrapper %}
<div class="tab-content">
<div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
{% block content %}
<div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
{# Warn about missing prerequisite objects #}
{% if prerequisite_model %}
{% include 'inc/missing_prerequisites.html' %}
{% endif %}
{# Warn about missing prerequisite objects #}
{% if prerequisite_model %}
{% include 'inc/missing_prerequisites.html' %}
{% endif %}
<form action="" method="post" enctype="multipart/form-data" class="form-object-edit mt-5">
{% csrf_token %}
<form action="" method="post" enctype="multipart/form-data" class="form-object-edit mt-5">
{% csrf_token %}
<div id="form_fields">
{% block form %}
{% include 'htmx/form.html' %}
{% endblock form %}
</div>
<div id="form_fields">
{% block form %}
{% include 'htmx/form.html' %}
{% endblock form %}
</div>
<div class="text-end my-3">
{% block buttons %}
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
{% if object.pk %}
<button type="submit" name="_update" class="btn btn-primary">
{% trans "Save" %}
</button>
{% else %}
<button type="submit" name="_create" class="btn btn-primary">
{% trans "Create" %}
</button>
<button type="submit" name="_addanother" class="btn btn-outline-primary">
{% trans "Create & Add Another" %}
</button>
{% endif %}
{% endblock buttons %}
</div>
</form>
</div>
<div class="text-end my-3">
{% block buttons %}
<a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
{% if object.pk %}
<button type="submit" name="_update" class="btn btn-primary">
{% trans "Save" %}
</button>
{% else %}
<button type="submit" name="_create" class="btn btn-primary">
{% trans "Create" %}
</button>
<button type="submit" name="_addanother" class="btn btn-outline-primary">
{% trans "Create & Add Another" %}
</button>
{% endif %}
{% endblock buttons %}
</div>
</form>
</div>
{% endblock content-wrapper %}
{% endblock content %}
{% block modals %}
{% include 'inc/htmx_modal.html' with size='lg' %}