diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3517f1d94..94b9bc42b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -128,9 +128,9 @@ module ApplicationHelper # * :download - Force download (default: false) def link_to_attachment(attachment, options={}) text = options.delete(:text) || attachment.filename - icon = 'attachment' + icon = options.fetch(:icon, false) + if options.delete(:download) - icon = 'download' route_method = :download_named_attachment_url options[:filename] = attachment.filename else @@ -142,7 +142,9 @@ module ApplicationHelper options[:only_path] = true unless options.key?(:only_path) url = send(route_method, attachment, options) - link_to icon_with_label(icon, text), url, html_options + + label = icon ? icon_with_label(icon, text) : text + link_to label, url, html_options end # Generates a link to a SCM revision diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index c90f0df7a..1eac93344 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -15,9 +15,9 @@ <% for attachment in attachments %> - <%= link_to_attachment attachment, class: 'icon icon-attachment ' -%> + <%= link_to_attachment attachment, class: 'icon icon-attachment ', icon: 'attachment' -%> (<%= number_to_human_size attachment.filesize %>) - <%= link_to_attachment attachment, class: 'icon-only icon-download ', title: l(:button_download), download: true -%> + <%= link_to_attachment attachment, class: 'icon-only icon-download ', title: l(:button_download), download: true, icon: 'download' -%> <%= attachment.description unless attachment.description.blank? %>