Skip to content

Commit 9407a98

Browse files
committed
Issues view: show consistent titles/captions and add a localized Preview label
1 parent 56fbecf commit 9407a98

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

app/views/attachments/_links.html.erb

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
<table>
1212
<% for attachment in attachments %>
13+
<% caption = "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }" %>
1314
<tr>
1415
<td>
1516
<% if attachment.is_image? %>
@@ -19,11 +20,11 @@
1920
<%= link_to l(:button_view),
2021
{ :controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename },
2122
:class => 'icon-only icon-magnifier lightbox_preview ' + attachment.filename.split('.').last.downcase,
22-
:rel => 'attachments', :title => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }",
23+
:rel => 'attachments', :title => l(:label_preview),
2324
:data => {
2425
:type => 'image',
2526
:fancybox => 'attachments',
26-
:caption => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }"
27+
:caption => caption
2728
} %>
2829

2930
<% elsif attachment.is_pdf? %>
@@ -33,11 +34,11 @@
3334
<%= link_to l(:button_view),
3435
{ :controller => 'attachments', :action => 'download_inline', :id => attachment, :filename => attachment.filename },
3536
:class => 'icon-only icon-magnifier lightbox_preview pdf',
36-
:rel => 'attachments', :title => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }",
37+
:rel => 'attachments', :title => l(:label_preview),
3738
:data => {
3839
:type => 'iframe',
3940
:fancybox => 'attachments',
40-
:caption => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }"
41+
:caption => caption
4142
} %>
4243

4344
<% else %>
@@ -74,15 +75,16 @@
7475
<% if images.any? %>
7576
<div class="thumbnails images">
7677
<% images.each do |attachment| %>
78+
<% caption = "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }" %>
7779
<div>
7880
<%=
7981
link_to image_tag(url_for(:controller => 'attachments', :action => 'thumbnail', :id => attachment)),
8082
{ :controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename },
81-
:class => ('lightbox' + (attachment.is_pdf? ? ' pdf' : '')) , :rel => 'thumbnails', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }",
83+
:class => ('lightbox' + (attachment.is_pdf? ? ' pdf' : '')) , :rel => 'thumbnails', :title => l(:label_preview) + ': ' + caption,
8284
:data => {
8385
:type => attachment.is_pdf? ? 'iframe' : 'image',
8486
:fancybox => 'thumbnails',
85-
:caption => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }"
87+
:caption => caption
8688
}
8789
%>
8890
</div>
@@ -94,13 +96,14 @@
9496
<% unless images.empty? %>
9597
<div class='images'>
9698
<% images.each do |attachment| %>
99+
<% caption = "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }" %>
97100
<%= link_to image_tag(url_for({:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename }), :width => Setting.thumbnails_size),
98101
{ :controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename },
99-
:class => 'lightbox', :rel => 'thumbnails', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }",
102+
:class => 'lightbox', :rel => 'thumbnails', :title => l(:label_preview) + ': ' + caption,
100103
:data => {
101104
:type => attachment.is_pdf? ? 'iframe' : 'image',
102105
:fancybox => 'thumbnails',
103-
:caption => "#{attachment.filename}#{ (' - ' + attachment.description) unless attachment.description.blank? }"
106+
:caption => caption
104107
}
105108
%>
106109
<% end -%>

0 commit comments

Comments
 (0)