Skip to content

Commit

Permalink
cove_rdls/templates/cove_rdls/additional_fields_table.html: Improve t…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
Ed (ODSC) committed Sep 6, 2023
1 parent 083eebf commit 0780a46
Showing 1 changed file with 59 additions and 7 deletions.
66 changes: 59 additions & 7 deletions cove_rdls/templates/cove_rdls/additional_fields_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,83 @@
<thead>
<tr>
<th class="">{% trans 'Field Name' %}</th>
<th class="">{% trans 'Field Path' %}</th>
<th class="">{% trans 'Usage Count' %}
<th class="">{% trans 'First 3 Values' %}</th>
<th class="">{% trans 'First 3 Locations' %}</th>
<th class="">{% trans 'Child Fields' %}</th>
</tr>
</thead>
<tbody>
{% for key, value in additional_fields.items %}
{% for full_path, info in additional_fields.items %}
{% if info.root_additional_field %}
<tr>
<td>
{{ value.field_name }}
{{ info.field_name }}
</td>
<td>
{{ value.examples|length }}
{{ full_path }}
</td>
<td>
{% for error in value.examples|slice:":3" %}
{{ info.count }}
</td>
<td>
{% for example in info.examples|slice:":3" %}
<li>
{{ error.path|join:"/" }}
{{ example }}
</li>
{% endfor %}
</td>
<td>
{{ value.path }}
{% if info.additional_field_descendance %}
{{info.additional_field_descendance|length}}
<a data-toggle="modal" data-target="#additional-field-{{full_path|slugify}}">{% trans "(See child fields)" %}</a>
{% endif %}
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

{% for parent_full_path, parent_info in additional_fields.items %}
{% if parent_info.root_additional_field and parent_info.additional_field_descendance %}
<div class="modal fade" id="additional-field-{{parent_full_path|slugify}}" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4>{% blocktrans %}Child fields of {{parent_full_path}}{% endblocktrans %} </h4>

</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th> {% trans 'Field' %}</th>
<th> {% trans 'Path to Field' %}</th>
<th> {% trans 'Usage Count' %}</th>
<th> {% trans 'Examples (first 3)' %}</th>
</tr>
</thead>
<tbody>
{% for full_path, info in parent_info.additional_field_descendance.items %}
<tr>
<td>{{info.field_name}}</td>
<td>{{info.path}}</td>
<td>{{info.count}}</td>
<td>
{% for example in info.examples %}
{{example}} <br />
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}

0 comments on commit 0780a46

Please sign in to comment.