##// END OF EJS Templates
Don't check if attachments are editable individually....
Jean-Philippe Lang -
r13553:e04c819895cd
parent child
Show More
@@ -34,12 +34,17 module AttachmentsHelper
34 def link_to_attachments(container, options = {})
34 def link_to_attachments(container, options = {})
35 options.assert_valid_keys(:author, :thumbnails)
35 options.assert_valid_keys(:author, :thumbnails)
36
36
37 if container.attachments.any?
37 attachments = container.attachments.preload(:author).to_a
38 options = {:deletable => container.attachments_deletable?, :author => true}.merge(options)
38 if attachments.any?
39 options = {
40 :editable => container.attachments_editable?,
41 :deletable => container.attachments_deletable?,
42 :author => true
43 }.merge(options)
39 render :partial => 'attachments/links',
44 render :partial => 'attachments/links',
40 :locals => {
45 :locals => {
41 :container => container,
46 :container => container,
42 :attachments => container.attachments,
47 :attachments => attachments,
43 :options => options,
48 :options => options,
44 :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?)
49 :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?)
45 }
50 }
@@ -2,7 +2,7
2 <div class="contextual">
2 <div class="contextual">
3 <%= link_to image_tag('edit.png'),
3 <%= link_to image_tag('edit.png'),
4 container_attachments_edit_path(container),
4 container_attachments_edit_path(container),
5 :title => l(:label_edit_attachments) if attachments.any?(&:editable?) %>
5 :title => l(:label_edit_attachments) if options[:editable] %>
6 </div>
6 </div>
7 <% for attachment in attachments %>
7 <% for attachment in attachments %>
8 <p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
8 <p><%= link_to_attachment attachment, :class => 'icon icon-attachment', :download => true -%>
General Comments 0
You need to be logged in to leave comments. Login now