Added a log entry detail page for collection element deleted log entries.

This commit is contained in:
Jan Böhmer 2023-05-18 23:05:40 +02:00
parent 434826c125
commit 8bb8257e62
4 changed files with 41 additions and 9 deletions

View file

@ -0,0 +1,15 @@
{# @var entry \App\Entity\LogSystem\CollectionElementDeleted #}
{% import "log_system/details/helper.macro.html.twig" as log_helper %}
<p class="m-0">
<b>{% trans %}log.collection_deleted.deleted{% endtrans %}</b>:
{{ entity_type_label(entry.deletedElementClass) }} #{{ entry.deletedElementID }}
{% if entry.oldName is not empty %}
({{ entry.oldName }})
{% endif %}
</p>
<p class="m-0">
<b>{% trans %}log.collection_deleted.on_collection{% endtrans %}</b>:
{{ log_helper.translate_field(entry.collectionName) }}
</p>

View file

@ -56,6 +56,17 @@
</p>
{% endmacro %}
{% macro translate_field(field) %}
{% set trans_key = 'log.element_edited.changed_fields.'~field %}
{# If the translation key is not found, the translation key is returned, and we dont show the translation #}
{% if trans_key|trans != trans_key %}
{{ ('log.element_edited.changed_fields.'~field) | trans }}
<span class="text-muted">({{ field }})</span>
{% else %}
{{ field }}
{% endif %}
{% endmacro %}
{% macro data_change_table(entry) %}
{# @var entry \App\Entity\LogSystem\ElementEditedLogEntry|\App\Entity\LogSystem\ElementDeletedLogEntry entry #}
@ -100,15 +111,7 @@
{% for field in fields %}
<tr>
<td title="{{ field }}">
{% set trans_key = 'log.element_edited.changed_fields.'~field %}
{# If the translation key is not found, the translation key is returned, and we dont show the translation #}
{% if trans_key|trans != trans_key %}
{{ ('log.element_edited.changed_fields.'~field) | trans }}
<span class="text-muted">({{ field }})</span>
{% else %}
{{ field }}
{% endif %}
{{ _self.translate_field(field) }}
</td>
{% if old_data is not empty %}
<td>

View file

@ -108,6 +108,8 @@
{% include "log_system/details/_extra_user_not_allowed.html.twig" %}
{% elseif log_entry is instanceof('App\\Entity\\LogSystem\\SecurityEventLogEntry') %}
{% include "log_system/details/_extra_security_event.html.twig" %}
{% elseif log_entry is instanceof('App\\Entity\\LogSystem\\CollectionElementDeleted') %}
{% include "log_system/details/_extra_collection_element_deleted.html.twig" %}
{% else %}
{{ extra_html | raw }}
{% endif %}

View file

@ -11421,5 +11421,17 @@ Element 3</target>
<target>If this is an element history entry, this breaks the element history! This can lead to unexpected results when using the time travel function.</target>
</segment>
</unit>
<unit id="P.c4WmY" name="log.collection_deleted.on_collection">
<segment>
<source>log.collection_deleted.on_collection</source>
<target>on Collection</target>
</segment>
</unit>
<unit id=".wiLJk6" name="log.element_edited.changed_fields.attachments">
<segment>
<source>log.element_edited.changed_fields.attachments</source>
<target>Attachments</target>
</segment>
</unit>
</file>
</xliff>