From 002081f2245eb2f75848c0fed0cacf93902d0cf7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 14 Jan 2012 15:55:54 +0000 Subject: [PATCH] Change attachment link to download and add a view link for text attachments (#4774). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8645 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/issues_helper.rb | 2 +- app/views/attachments/_links.html.erb | 11 ++++++++--- public/images/magnifier.png | Bin 0 -> 615 bytes 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 public/images/magnifier.png diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 49d734452..9698949f2 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -210,7 +210,7 @@ module IssuesHelper old_value = content_tag("strike", old_value) if detail.old_value and detail.value.blank? if detail.property == 'attachment' && !value.blank? && a = Attachment.find_by_id(detail.prop_key) # Link to the attachment if it has not been removed - value = link_to_attachment(a) + value = link_to_attachment(a, :download => true) else value = content_tag("i", h(value)) if value end diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index c92599a66..0b1480aad 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -1,9 +1,14 @@
<% for attachment in attachments %> -

<%= link_to_attachment attachment, :class => 'icon icon-attachment' -%> -<%= h(" - #{attachment.description}") unless attachment.description.blank? %> +

<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> + <%= h(" - #{attachment.description}") unless attachment.description.blank? %> (<%= number_to_human_size attachment.filesize %>) - <% if options[:deletable] %> + <% if attachment.is_text? %> + <%= link_to image_tag('magnifier.png'), + :controller => 'attachments', :action => 'show', + :id => attachment, :filename => attachment.filename %> + <% end %> + <% if options[:deletable] %> <%= link_to image_tag('delete.png'), attachment_path(attachment), :confirm => l(:text_are_you_sure), :method => :delete, diff --git a/public/images/magnifier.png b/public/images/magnifier.png new file mode 100644 index 0000000000000000000000000000000000000000..cf3d97f75e9cde9c143980d89272fe61fc2d64ee GIT binary patch literal 615 zcmV-t0+{`YP)gNuvOO$0ks zMIj=HnnBRUR?tKXG11rxCU4&7dG4NbuvR2_mEvc)n?Cow;~Wve|KR^>9@p5l)|QB+ z$jmun3q#x>;ss-PW_mnr2MHVzLAl1RW&0?VkixF*4t!St0YVb2wnKdU(kmOHiL;aW zK8Xte%(k>MVGG$E4no6dcNnb>BhVHHGD&1pv4YZ68kE2V03t5#PCEFm7=ad$6)+3B zTCmn*?A?=u(o~ET7~-7g0)ZB=6|lumi4}B}MLgy~Ysy6)Q5%Al7|05&1z3Jpu>cF8 z3?VXs*3<}%h3`5Wld)N2zJnk%Agw<~3k)sPTLFd=F5;d8-bj-09SkQuynfflNcZLN z!^_37fdZvzrq=9~mp*($%mcDRKC&qvaaZuX+C=AT6O*~tHl>0mcP<_q>-z%$xO(@! zYluq5a8VQI$S@4?r*v;gPo!QQ%pX3A#>xx4t=w-L6COWx?aj&`f+!YePsFtj=hOQR zP3=E2j@9L7s8;T^&s?u(Hdpu?CubjMrGn{t_37>9$|AD)QE08weJlKn8|OyjL~7oP zC8mPT`jzuH*Dh^I0048RGafUIT)4H~*m8m>egI0iH=(LB%b@@O002ovPDHLkV1lw0 B3