Added a subprojects tab to project info

This commit is contained in:
Jan Böhmer 2022-12-31 14:34:30 +01:00
parent 742b2d3d48
commit 2b1b86eb7e
3 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,28 @@
<table class="table table-striped table-hover">
<thead>
<tr>
<th>{% trans %}name.label{% endtrans %}</th>
<th>{% trans %}description.label{% endtrans %}</th>
<th># {% trans %}project.info.bom_entries_count{% endtrans %}</th>
<th># {% trans %}project.info.sub_projects_count{% endtrans %}</th>
</tr>
</thead>
<tbody>
{% for subproject in project.children %}
<tr>
<td> {# Name #}
<a href="{{ entity_url(subproject, 'info') }}">{{ subproject.name }}</a>
</td>
<td> {# Description #}
{{ subproject.description | format_markdown }}
</td>
<td>
{{ subproject.bomEntries | length }}
</td>
<td>
{{ subproject.children | length }}
</td>
</tr>
{% endfor %}
</tbody>
</table>

View file

@ -39,12 +39,23 @@
{% trans %}project.info.info.label{% endtrans %} {% trans %}project.info.info.label{% endtrans %}
</button> </button>
</li> </li>
{% if project.children is not empty %}
<li class="nav-item" role="presentation">
<button class="nav-link" id="subprojects-tab" data-bs-toggle="tab" data-bs-target="#subprojects-tab-pane"
type="button" role="tab" aria-controls="subprojects-tab-pane" aria-selected="false">
<i class="fa-solid fa-folder-tree fa-fw"></i>
{% trans %}project.info.sub_projects.label{% endtrans %}
<span class="badge bg-secondary">{{ project.children | length }}</span>
</button>
</li>
{% endif %}
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<button class="nav-link" id="bom-tab" data-bs-toggle="tab" data-bs-target="#bom-tab-pane" <button class="nav-link" id="bom-tab" data-bs-toggle="tab" data-bs-target="#bom-tab-pane"
type="button" role="tab" aria-controls="bom-tab-pane" aria-selected="false"> type="button" role="tab" aria-controls="bom-tab-pane" aria-selected="false">
<i class="fa-solid fa-list-check fa-fw"></i> <i class="fa-solid fa-list-check fa-fw"></i>
{% trans %}project_bom_entry.label{% endtrans %} {% trans %}project_bom_entry.label{% endtrans %}
<span class="badge bg-secondary">{{ project.bomEntries | length }}</span></button> <span class="badge bg-secondary">{{ project.bomEntries | length }}</span>
</button>
</li> </li>
<li class="nav-item" role="presentation"> <li class="nav-item" role="presentation">
<button class="nav-link" id="attachments-tab" data-bs-toggle="tab" data-bs-target="#attachments-tab-pane" <button class="nav-link" id="attachments-tab" data-bs-toggle="tab" data-bs-target="#attachments-tab-pane"
@ -56,6 +67,11 @@
<div class="tab-pane fade show active" id="info-tab-pane" role="tabpanel" aria-labelledby="info-tab" tabindex="0"> <div class="tab-pane fade show active" id="info-tab-pane" role="tabpanel" aria-labelledby="info-tab" tabindex="0">
{% include "Projects/info/_info.html.twig" %} {% include "Projects/info/_info.html.twig" %}
</div> </div>
{% if project.children is not empty %}
<div class="tab-pane fade" id="subprojects-tab-pane" role="tabpanel" aria-labelledby="bom-tab" tabindex="0">
{% include "Projects/info/_subprojects.html.twig" %}
</div>
{% endif %}
<div class="tab-pane fade" id="bom-tab-pane" role="tabpanel" aria-labelledby="bom-tab" tabindex="0"> <div class="tab-pane fade" id="bom-tab-pane" role="tabpanel" aria-labelledby="bom-tab" tabindex="0">
{% include "Projects/info/_bom.html.twig" %} {% include "Projects/info/_bom.html.twig" %}
</div> </div>

View file

@ -10121,5 +10121,11 @@ Element 3</target>
<target>Info</target> <target>Info</target>
</segment> </segment>
</unit> </unit>
<unit id="vaFaY8r" name="project.info.sub_projects.label">
<segment>
<source>project.info.sub_projects.label</source>
<target>Subprojects</target>
</segment>
</unit>
</file> </file>
</xliff> </xliff>