From e04c819895cd31cb6639992e4dbe3296a19ac079 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 24 Jan 2015 09:07:33 +0000 Subject: [PATCH] Don't check if attachments are editable individually. git-svn-id: http://svn.redmine.org/redmine/trunk@13935 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/attachments_helper.rb | 11 ++++++++--- app/views/attachments/_links.html.erb | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index bc3ba518d..f7f9007b5 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -34,12 +34,17 @@ module AttachmentsHelper def link_to_attachments(container, options = {}) options.assert_valid_keys(:author, :thumbnails) - if container.attachments.any? - options = {:deletable => container.attachments_deletable?, :author => true}.merge(options) + attachments = container.attachments.preload(:author).to_a + if attachments.any? + options = { + :editable => container.attachments_editable?, + :deletable => container.attachments_deletable?, + :author => true + }.merge(options) render :partial => 'attachments/links', :locals => { :container => container, - :attachments => container.attachments, + :attachments => attachments, :options => options, :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?) } diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index cc54b0137..001a038db 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -2,7 +2,7 @@
<%= link_to image_tag('edit.png'), container_attachments_edit_path(container), - :title => l(:label_edit_attachments) if attachments.any?(&:editable?) %> + :title => l(:label_edit_attachments) if options[:editable] %>
<% for attachment in attachments %>

<%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%> -- 2.39.5