]> source.dussan.org Git - redmine.git/commitdiff
Don't check if attachments are editable individually.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 24 Jan 2015 09:07:33 +0000 (09:07 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 24 Jan 2015 09:07:33 +0000 (09:07 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13935 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/attachments_helper.rb
app/views/attachments/_links.html.erb

index bc3ba518d90a28fcb2d373607fdffa1cf91c4d10..f7f9007b5cb7c40d07cfca3fef4613e8c0f043fa 100644 (file)
@@ -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?)
         }
index cc54b0137d1345f5c119ff163211439ab778cf40..001a038dbeb934df1be1302c2d66b0e2e1fcb765 100644 (file)
@@ -2,7 +2,7 @@
 <div class="contextual">
   <%= 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] %>
 </div>
 <% for attachment in attachments %>
 <p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>