mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 01:25:55 +02:00
Mark the special project build status in part info page and parts tables
This commit is contained in:
parent
fdcd1b9d9d
commit
05c4adb928
6 changed files with 47 additions and 3 deletions
|
@ -57,6 +57,10 @@ class PartDataTableHelper
|
|||
if ($context->isNeedsReview()) {
|
||||
$icon = sprintf('<i class="fa-solid fa-ambulance fa-fw me-1" title="%s"></i>', $this->translator->trans('part.needs_review.badge'));
|
||||
}
|
||||
if ($context->getBuiltProject() !== null) {
|
||||
$icon = sprintf('<i class="fa-solid fa-box-archive fa-fw me-1" title="%s"></i>',
|
||||
$this->translator->trans('part.info.projectBuildPart.hint') . ': ' . $context->getBuiltProject()->getName());
|
||||
}
|
||||
|
||||
|
||||
return sprintf(
|
||||
|
|
|
@ -62,6 +62,13 @@ class PartPreviewGenerator
|
|||
}
|
||||
}
|
||||
|
||||
if (null !== $part->getBuiltProject()) {
|
||||
$attachment = $part->getBuiltProject()->getMasterPictureAttachment();
|
||||
if ($this->isAttachmentValidPicture($attachment)) {
|
||||
$list[] = $attachment;
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $part->getCategory()) {
|
||||
$attachment = $part->getCategory()->getMasterPictureAttachment();
|
||||
if ($this->isAttachmentValidPicture($attachment)) {
|
||||
|
@ -109,7 +116,7 @@ class PartPreviewGenerator
|
|||
return $attachment;
|
||||
}
|
||||
|
||||
//Otherwise check if the part has a footprint with a valid masterattachment
|
||||
//Otherwise check if the part has a footprint with a valid master attachment
|
||||
if (null !== $part->getFootprint()) {
|
||||
$attachment = $part->getFootprint()->getMasterPictureAttachment();
|
||||
if ($this->isAttachmentValidPicture($attachment)) {
|
||||
|
@ -117,6 +124,14 @@ class PartPreviewGenerator
|
|||
}
|
||||
}
|
||||
|
||||
//With lowest priority use the master attachment of the project this part represents (when existing)
|
||||
if (null !== $part->getBuiltProject()) {
|
||||
$attachment = $part->getBuiltProject()->getMasterPictureAttachment();
|
||||
if ($this->isAttachmentValidPicture($attachment)) {
|
||||
return $attachment;
|
||||
}
|
||||
}
|
||||
|
||||
//If nothing is available return null
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -37,14 +37,20 @@
|
|||
<td>{{ part.iD }}</td>
|
||||
</tr>
|
||||
|
||||
<tr> {# ID #}
|
||||
<tr> {# IPN #}
|
||||
<td>{% trans %}part.edit.ipn{% endtrans %}</td>
|
||||
<td>{{ part.ipn ?? 'part.ipn.not_defined'|trans }}</td>
|
||||
</tr>
|
||||
|
||||
<tr> {# Favorite status #}
|
||||
<td>{% trans %}part.isFavorite{% endtrans %}</td>
|
||||
<td>{{ helper.boolean(part.favorite) }}</td>
|
||||
<td>{{ helper.boolean_badge(part.favorite) }}</td>
|
||||
</tr>
|
||||
|
||||
<tr> {# Build status #}
|
||||
<td>{% trans %}part.is_build_part{% endtrans %}</td>
|
||||
<td>{{ helper.boolean_badge(part.projectBuildPart) }}
|
||||
{% if part.projectBuildPart %}(<a href="{{ entity_url(part.builtProject, "edit") }}">{{ part.builtProject.name }}</a>){% endif %}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
<b class="mb-2">{% trans with {'%timestamp%': timeTravel|format_datetime('short')} %}part.info.timetravel_hint{% endtrans %}</b>
|
||||
{% endif %}
|
||||
|
||||
{% if part.projectBuildPart %}
|
||||
<b class="mb-2">{% trans %}part.info.projectBuildPart.hint{% endtrans %}: <a href="{{ entity_url(part.builtProject) }}">{{ part.builtProject.name }}</a></b>
|
||||
{% endif %}
|
||||
|
||||
<div class="mb-3">
|
||||
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
|
||||
<i class="fas fa-history fa-fw"></i> {{ helper.date_user_combination(part, true) }}
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
{% if timeTravel != null %}
|
||||
<i>({{ timeTravel | format_datetime('short') }})</i>
|
||||
{% endif %}
|
||||
{% if part.projectBuildPart %}
|
||||
(<i>{{ entity_type_label(part.builtProject) }}</i>: <a class="text-white" href="{{ entity_url(part.builtProject) }}">{{ part.builtProject.name }}</a>)
|
||||
{% endif %}
|
||||
<div class="float-end">
|
||||
{% trans %}id.label{% endtrans %}: {{ part.id }} {% if part.ipn is not empty %}(<i>{{ part.ipn }}</i>){% endif %}
|
||||
</div>
|
||||
|
|
|
@ -10079,5 +10079,17 @@ Element 3</target>
|
|||
<target>This part represents the builds of this project, which are stored somewhere.</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="Ze.0yTx" name="part.info.projectBuildPart.hint">
|
||||
<segment>
|
||||
<source>part.info.projectBuildPart.hint</source>
|
||||
<target>This part represents the builds of the following project and is associated with it</target>
|
||||
</segment>
|
||||
</unit>
|
||||
<unit id="coJxmoK" name="part.is_build_part">
|
||||
<segment>
|
||||
<source>part.is_build_part</source>
|
||||
<target>Is project builds part</target>
|
||||
</segment>
|
||||
</unit>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue