Redmine:自动预览附件图片

在{BitNami Redmine Stack}\apps\redmine\htdocs\app\views\attachments\_links.html.erb 的最后面增加以下内容即可:

 

<% images = attachments.select { |a| a.image? } %>

<% unless images.empty? %>
<div class='images'>
<% images.each do |attachment| %>
<%= link_to image_tag(url_for({:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename })),
{:controller => 'attachments', :action => 'show', :id => attachment, :filename => attachment.filename }, :class => 'lightbox', :rel => 'attachments', :title => "#{attachment.filename}#{ ('-' + attachment.description) unless attachment.description.blank? }" %>
<% end -%>
</div>
<% end -%>

你可能感兴趣的:(redmine)