]> source.dussan.org Git - redmine.git/commitdiff
Change attachment link to download and add a view link for text attachments (#4774).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 14 Jan 2012 15:55:54 +0000 (15:55 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 14 Jan 2012 15:55:54 +0000 (15:55 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8645 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/issues_helper.rb
app/views/attachments/_links.html.erb
public/images/magnifier.png [new file with mode: 0644]

index 49d7344523bd9056c73d16a02264da7a9abc28a5..9698949f265362694799fa2b75f9aba1ae0e6f77 100644 (file)
@@ -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
index c92599a6641bf36abd67d321b1d6d5efc9584e5f..0b1480aadf0c3024bde4d8938213ddb86bcc4169 100644 (file)
@@ -1,9 +1,14 @@
 <div class="attachments">
 <% for attachment in attachments %>
-<p><%= link_to_attachment attachment, :class => 'icon icon-attachment' -%>
-<%= h(" - #{attachment.description}") unless attachment.description.blank? %>
+<p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
+  <%= h(" - #{attachment.description}") unless attachment.description.blank? %>
   <span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
-  <% 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 (file)
index 0000000..cf3d97f
Binary files /dev/null and b/public/images/magnifier.png differ