@@ -34,12 +34,17 module AttachmentsHelper | |||
|
34 | 34 | def link_to_attachments(container, options = {}) |
|
35 | 35 | options.assert_valid_keys(:author, :thumbnails) |
|
36 | 36 | |
|
37 | if container.attachments.any? | |
|
38 | options = {:deletable => container.attachments_deletable?, :author => true}.merge(options) | |
|
37 | attachments = container.attachments.preload(:author).to_a | |
|
38 | if attachments.any? | |
|
39 | options = { | |
|
40 | :editable => container.attachments_editable?, | |
|
41 | :deletable => container.attachments_deletable?, | |
|
42 | :author => true | |
|
43 | }.merge(options) | |
|
39 | 44 | render :partial => 'attachments/links', |
|
40 | 45 | :locals => { |
|
41 | 46 | :container => container, |
|
42 |
:attachments => |
|
|
47 | :attachments => attachments, | |
|
43 | 48 | :options => options, |
|
44 | 49 | :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?) |
|
45 | 50 | } |
@@ -2,7 +2,7 | |||
|
2 | 2 | <div class="contextual"> |
|
3 | 3 | <%= link_to image_tag('edit.png'), |
|
4 | 4 | container_attachments_edit_path(container), |
|
5 |
:title => l(:label_edit_attachments) if |
|
|
5 | :title => l(:label_edit_attachments) if options[:editable] %> | |
|
6 | 6 | </div> |
|
7 | 7 | <% for attachment in attachments %> |
|
8 | 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