Added a link to view external version from attachment edit

This commit is contained in:
Jan Böhmer 2025-02-22 17:15:37 +01:00
parent ae5dfbfc52
commit 41ae9b5f75
3 changed files with 21 additions and 2 deletions

View file

@ -152,9 +152,10 @@
</button> </button>
{% set attach = form.vars.value %} {% set attach = form.vars.value %}
{# @var \App\Entity\Attachments\Attachment attach #}
{% if attach is not null %} {% if attach is not null %}
{% if not attach.hasInternal() %} {% if not attach.hasInternal() and attach.external %}
<div class="mt-2"> <div class="mt-2">
<span class="badge bg-primary"> <span class="badge bg-primary">
<i class="fas fa-fw fa-globe"></i> {% trans %}attachment.external_only{% endtrans %} <i class="fas fa-fw fa-globe"></i> {% trans %}attachment.external_only{% endtrans %}
@ -194,7 +195,13 @@
<i class="fas fa-exclamation-circle fa-fw"></i> {% trans %}attachment.file_not_found{% endtrans %} <i class="fas fa-exclamation-circle fa-fw"></i> {% trans %}attachment.file_not_found{% endtrans %}
</span> </span>
</div> </div>
{% endif %}
{% if attach.external %}
<div>
<a href="{{ attach.externalPath }}" rel="noopener" target="_blank" data-turbo="false" class="link-external"
title="{% trans with {"%host%": attach.host} %}attachment.view_external.view_at{% endtrans %}">{% trans %}attachment.view_external{% endtrans %}</a>
</div>
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -58,7 +58,7 @@
<td><div class="btn-group" role="group" aria-label=""> <td><div class="btn-group" role="group" aria-label="">
<a {% if attachment.hasExternal() %}href="{{ attachment.externalPath }}"{% endif %} target="_blank" <a {% if attachment.hasExternal() %}href="{{ attachment.externalPath }}"{% endif %} target="_blank"
class="btn btn-secondary {% if not attachment.hasExternal() %}disabled{% endif %}" class="btn btn-secondary {% if not attachment.hasExternal() %}disabled{% endif %}"
data-turbo="false" title="View at {{ attachment.host }}" rel="noopener"> {# TODO: translate #} data-turbo="false" title="{% trans with {"%host%": attachment.host} %}attachment.view_external.view_at{% endtrans %}" rel="noopener">
<i class="fas fa-globe fa-fw"></i> <i class="fas fa-globe fa-fw"></i>
</a> </a>
<a {% if attachment_manager.isInternalFileExisting(attachment) %}href="{{ entity_url(attachment, 'file_view') }}"{% endif %} target="_blank" <a {% if attachment_manager.isInternalFileExisting(attachment) %}href="{{ entity_url(attachment, 'file_view') }}"{% endif %} target="_blank"

View file

@ -12333,5 +12333,17 @@ Please note, that you can not impersonate a disabled user. If you try you will g
<target>External link</target> <target>External link</target>
</segment> </segment>
</unit> </unit>
<unit id="2WKNZAm" name="attachment.view_external.view_at">
<segment>
<source>attachment.view_external.view_at</source>
<target>View at %host%</target>
</segment>
</unit>
<unit id="nwO78O_" name="attachment.view_external">
<segment>
<source>attachment.view_external</source>
<target>View external version</target>
</segment>
</unit>
</file> </file>
</xliff> </xliff>