[Rt-commit] rt branch, 5.0/display-attachment-name-in-history, created. rt-5.0.0alpha1-1-g7bac51deed
Blaine Motsinger
blaine at bestpractical.com
Mon Apr 27 15:57:32 EDT 2020
The branch, 5.0/display-attachment-name-in-history has been created
at 7bac51deed66c77723afa35bffebadb7c23d3ba3 (commit)
- Log -----------------------------------------------------------------
commit 7bac51deed66c77723afa35bffebadb7c23d3ba3
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Fri Apr 24 18:21:16 2020 -0500
Display the attachment name in ticket history
If a ticket has a lot of attachments it can be cumbersome to hover
over the download link to find the file you want. This commit makes
the filename available on the page and moves the filetype and size
into the tooltip instead.
This commit additionally corrects an alignment issue where the
downloadattachment div overlapped the above element's border if
there were many attachments in one transaction.
diff --git a/share/html/Elements/ShowTransactionAttachments b/share/html/Elements/ShowTransactionAttachments
index 53283d2fa2..5c0cdd3cbb 100644
--- a/share/html/Elements/ShowTransactionAttachments
+++ b/share/html/Elements/ShowTransactionAttachments
@@ -64,22 +64,22 @@ foreach my $message ( @{ $Attachments->{ $Parent || 0 } || [] } ) {
</%PERL>
<div class="downloadattachment">
% if (my $url = RT->System->ExternalStorageURLFor($message)) {
-<a href="<% $url %>">
+<a href="<% $url %>"
% } else {
-<a href="<% $AttachmentPath %>/<% $Transaction->Id %>/<% $message->Id %>/<% $name | un %>" target="_blank">
+<a href="<% $AttachmentPath %>/<% $Transaction->Id %>/<% $message->Id %>/<% $name | un %>" target="_blank"
% }
-% # the defined name denotes a downloadable attachment, else just text content in the transaction.
-% my ( $download_alt, $fa_classes );
-% if ( length $name ) {
-% $download_alt = loc( 'Download [_1]', $name );
-% $fa_classes = 'fas fa-paperclip';
-% }
-% else {
-% $download_alt = loc( 'View source' );
-% $fa_classes = 'far fa-file';
+% if ( length $name ) { # download link with filename
+% my $download_alt = loc( 'Download [_1] [_2]', $message->ContentType, $message->FriendlyContentLength );
+alt="<% $download_alt %>" data-toggle="tooltip" data-placement="bottom" data-original-title="<% $download_alt %>">
+ <span class="fas fa-paperclip fa-2x"></span>
+ <span class="downloadfilename"><% $name %></span></span>
+</a>
% }
-<span class="<% $fa_classes %> fa-2x" alt="<% $download_alt %>" data-toggle="tooltip" data-placement="bottom" data-original-title="<% $download_alt %>"></span></a>
-
+% else { # view source and view source headers, without filename or size
+% my $view_source_alt = loc( 'View source' );
+>
+ <span class="far fa-file fa-2x" alt="<% $view_source_alt %>" data-toggle="tooltip" data-placement="bottom" data-original-title="<% $view_source_alt %>"></span>
+</a>
% if ( $DownloadableHeaders && ! length $name && $message->ContentType =~ /text/ ) {
% my $download_with_headers_alt = loc('View source with headers');
<a href="<% $AttachmentPath %>/WithHeaders/<% $message->Id %>" target="_blank">
@@ -89,10 +89,7 @@ foreach my $message ( @{ $Attachments->{ $Parent || 0 } || [] } ) {
</span>
</a>
% }
-
-% $m->callback(CallbackName => 'AfterDownloadLinks', ARGSRef => \%ARGS, Object => $Object, Transaction => $Transaction, Attachment => $message);
-<br />
-<span class="downloadcontenttype"><% $message->ContentType %> <% $message->FriendlyContentLength %></span>
+% }
</div>
% }
%# If there is sub-messages, open a dedicated div
diff --git a/share/static/css/elevator-light/history.css b/share/static/css/elevator-light/history.css
index 678ea59557..fecc8a9ca1 100644
--- a/share/static/css/elevator-light/history.css
+++ b/share/static/css/elevator-light/history.css
@@ -171,14 +171,11 @@ border: none;
vertical-align: top;
}
-.transaction div.downloadattachment .downloadcontenttype{
- color: #ccc;
- display: block;
- margin-top: 0.25rem;
-padding-right:0.25em;
+.transaction div.downloadattachment .downloadfilename {
+ font-size: 0.9rem;
+ padding-left: 0.1em;
}
-
.transaction .message-header-key {
width: 7em;
font-weight: bold;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list