mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +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()) {
|
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'));
|
$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(
|
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()) {
|
if (null !== $part->getCategory()) {
|
||||||
$attachment = $part->getCategory()->getMasterPictureAttachment();
|
$attachment = $part->getCategory()->getMasterPictureAttachment();
|
||||||
if ($this->isAttachmentValidPicture($attachment)) {
|
if ($this->isAttachmentValidPicture($attachment)) {
|
||||||
|
@ -109,7 +116,7 @@ class PartPreviewGenerator
|
||||||
return $attachment;
|
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()) {
|
if (null !== $part->getFootprint()) {
|
||||||
$attachment = $part->getFootprint()->getMasterPictureAttachment();
|
$attachment = $part->getFootprint()->getMasterPictureAttachment();
|
||||||
if ($this->isAttachmentValidPicture($attachment)) {
|
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
|
//If nothing is available return null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,20 @@
|
||||||
<td>{{ part.iD }}</td>
|
<td>{{ part.iD }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr> {# ID #}
|
<tr> {# IPN #}
|
||||||
<td>{% trans %}part.edit.ipn{% endtrans %}</td>
|
<td>{% trans %}part.edit.ipn{% endtrans %}</td>
|
||||||
<td>{{ part.ipn ?? 'part.ipn.not_defined'|trans }}</td>
|
<td>{{ part.ipn ?? 'part.ipn.not_defined'|trans }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr> {# Favorite status #}
|
<tr> {# Favorite status #}
|
||||||
<td>{% trans %}part.isFavorite{% endtrans %}</td>
|
<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>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -4,6 +4,10 @@
|
||||||
<b class="mb-2">{% trans with {'%timestamp%': timeTravel|format_datetime('short')} %}part.info.timetravel_hint{% endtrans %}</b>
|
<b class="mb-2">{% trans with {'%timestamp%': timeTravel|format_datetime('short')} %}part.info.timetravel_hint{% endtrans %}</b>
|
||||||
{% endif %}
|
{% 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">
|
<div class="mb-3">
|
||||||
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
|
<span class="text-muted" title="{% trans %}lastModified{% endtrans %}">
|
||||||
<i class="fas fa-history fa-fw"></i> {{ helper.date_user_combination(part, true) }}
|
<i class="fas fa-history fa-fw"></i> {{ helper.date_user_combination(part, true) }}
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
{% if timeTravel != null %}
|
{% if timeTravel != null %}
|
||||||
<i>({{ timeTravel | format_datetime('short') }})</i>
|
<i>({{ timeTravel | format_datetime('short') }})</i>
|
||||||
{% endif %}
|
{% 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">
|
<div class="float-end">
|
||||||
{% trans %}id.label{% endtrans %}: {{ part.id }} {% if part.ipn is not empty %}(<i>{{ part.ipn }}</i>){% endif %}
|
{% trans %}id.label{% endtrans %}: {{ part.id }} {% if part.ipn is not empty %}(<i>{{ part.ipn }}</i>){% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10079,5 +10079,17 @@ Element 3</target>
|
||||||
<target>This part represents the builds of this project, which are stored somewhere.</target>
|
<target>This part represents the builds of this project, which are stored somewhere.</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</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>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue