mirror of
https://github.com/meineerde/redmine.git
synced 2026-01-31 11:37:14 +00:00
Add icon to attachment link only when icon variable is passed.
git-svn-id: https://svn.redmine.org/redmine/trunk@22990 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
ee54f091cb
commit
6b327b8852
@ -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
|
||||
|
||||
@ -15,9 +15,9 @@
|
||||
<% for attachment in attachments %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= link_to_attachment attachment, class: 'icon icon-attachment ' -%>
|
||||
<%= link_to_attachment attachment, class: 'icon icon-attachment ', icon: 'attachment' -%>
|
||||
<span class="size">(<%= number_to_human_size attachment.filesize %>)</span>
|
||||
<%= 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' -%>
|
||||
</td>
|
||||
<td><%= attachment.description unless attachment.description.blank? %></td>
|
||||
<td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user