Consolodate data file attributes into a reusable template

This commit is contained in:
Jeremy Stretch 2025-08-12 08:54:07 -04:00
parent 96306dcc6f
commit 9ecfd65fe2
4 changed files with 39 additions and 58 deletions

View File

@ -0,0 +1,36 @@
{% load i18n %}
<div class="card">
<h2 class="card-header">{% trans "Data File" %}</h2>
<table class="table table-hover attr-table">
<tr>
<th scope="row">{% trans "Data Source" %}</th>
<td>
{% if object.data_source %}
<a href="{{ object.data_source.get_absolute_url }}">{{ object.data_source }}</a>
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Data File" %}</th>
<td>
{% if object.data_file %}
<a href="{{ object.data_file.get_absolute_url }}">{{ object.data_file }}</a>
{% elif object.data_path %}
<div class="float-end text-warning">
<i class="mdi mdi-alert" title="{% trans "The data file associated with this object has been deleted" %}."></i>
</div>
{{ object.data_path }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Data Synced" %}</th>
<td>{{ object.data_synced|placeholder }}</td>
</tr>
</table>
</div>

View File

@ -29,37 +29,9 @@
<th scope="row">{% trans "Active" %}</th>
<td>{% checkmark object.is_active %}</td>
</tr>
<tr>
<th scope="row">{% trans "Data Source" %}</th>
<td>
{% if object.data_source %}
<a href="{{ object.data_source.get_absolute_url }}">{{ object.data_source }}</a>
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Data File" %}</th>
<td>
{% if object.data_file %}
<a href="{{ object.data_file.get_absolute_url }}">{{ object.data_file }}</a>
{% elif object.data_path %}
<div class="float-end text-warning">
<i class="mdi mdi-alert" title="{% trans "The data file associated with this object has been deleted" %}."></i>
</div>
{{ object.data_path }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Data Synced" %}</th>
<td>{{ object.data_synced|placeholder }}</td>
</tr>
</table>
</div>
{% include 'core/inc/datafile_panel.html' %}
<div class="card">
<h2 class="card-header">{% trans "Assignment" %}</h2>
<table class="table table-hover attr-table">

View File

@ -19,6 +19,7 @@
</tr>
</table>
</div>
{% include 'core/inc/datafile_panel.html' %}
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/tags.html' %}
{% include 'inc/panels/comments.html' %}

View File

@ -35,37 +35,9 @@
<th scope="row">{% trans "Attachment" %}</th>
<td>{% checkmark object.as_attachment %}</td>
</tr>
<tr>
<th scope="row">{% trans "Data Source" %}</th>
<td>
{% if object.data_source %}
<a href="{{ object.data_source.get_absolute_url }}">{{ object.data_source }}</a>
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Data File" %}</th>
<td>
{% if object.data_file %}
<a href="{{ object.data_file.get_absolute_url }}">{{ object.data_file }}</a>
{% elif object.data_path %}
<div class="float-end text-warning">
<i class="mdi mdi-alert" title="{% trans "The data file associated with this object has been deleted" %}."></i>
</div>
{{ object.data_path }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr>
<tr>
<th scope="row">{% trans "Data Synced" %}</th>
<td>{{ object.data_synced|placeholder }}</td>
</tr>
</table>
</div>
{% include 'core/inc/datafile_panel.html' %}
{% plugin_left_page object %}
</div>
<div class="col col-md-6">