Introduced a new twig variable localPart to split up the result

This commit is contained in:
Jan Böhmer 2024-12-31 12:56:09 +01:00
parent ed1076fa5a
commit a72231ab04

View file

@ -59,7 +59,10 @@
<tbody> <tbody>
{% for result in results %} {% for result in results %}
{% set dto = result["dto"] %} {% set dto = result["dto"] %}
<tr> {# @var App\Entity\Parts\Part localPart #}
{% set localPart = result["localPart"] %}
<tr >
<td> <td>
<img src="{{ dto.preview_image_url }}" data-thumbnail="{{ dto.preview_image_url }}" <img src="{{ dto.preview_image_url }}" data-thumbnail="{{ dto.preview_image_url }}"
class="hoverpic" style="max-width: 45px;" {{ stimulus_controller('elements/hoverpic') }}> class="hoverpic" style="max-width: 45px;" {{ stimulus_controller('elements/hoverpic') }}>
@ -109,16 +112,16 @@
{# TODO: would like to have a sort of "part exists!" text here, but don't know how to style it {# TODO: would like to have a sort of "part exists!" text here, but don't know how to style it
also it would be nice to have these two buttons closer together, but when I put them in one cell also it would be nice to have these two buttons closer together, but when I put them in one cell
they sometimes stack#} they sometimes stack#}
{% if result["localPart"] is not null %} {% if localPart is not null %}
<a class="btn btn-primary" href="{{ path('app_part_show', {'id': result['localPart'].id}) }}" <a class="btn btn-primary" href="{{ path('app_part_show', {'id': localPart.id}) }}"
target="_blank" title="Show Existing Part"> {# TODO: Needs translation #} target="_blank" title="Show Existing Part"> {# TODO: Needs translation #}
<i class="fa-solid fa-search"></i> <i class="fa-solid fa-search"></i>
</a> </a>
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if result["localPart"] is not null %} {% if localPart is not null %}
<a class="btn btn-primary" href="{{ path('part_edit', {'id': result['localPart'].id}) }}" <a class="btn btn-primary" href="{{ path('part_edit', {'id': localPart.id}) }}"
target="_blank" title="Edit Existing Part"> {# TODO: Needs translation #} target="_blank" title="Edit Existing Part"> {# TODO: Needs translation #}
<i class="fa-solid fa-pencil"></i> <i class="fa-solid fa-pencil"></i>
</a> </a>