diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index f61399c85..0ba0f3554 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -53,4 +53,21 @@ module AttachmentsHelper api.created_on attachment.created_on end end + + def link_to_memo_attachments(container, options = {}) + options.assert_valid_keys(:author, :thumbnails) + + if container.attachments.any? + options = {:deletable => deletable?(container), :author => true}.merge(options) + render :partial => 'attachments/links', + :locals => {:attachments => container.attachments, :options => options, :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?)} + end + end + + private + + def deletable? container, user=User.current + User.current.logged? && (container.author == user || user.admin?) + end + end diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 536c4f066..40c8e1e51 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -19,7 +19,8 @@ <%= sort_header_tag('filename', :caption => l(:field_filename)) %> <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %> <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %> - + <%#= sort_header_tag('downloads', :caption => l(:label_downloads_abbr), :default_order => 'desc') %> + <%= sort_header_tag('downloads', :caption => l(:field_downloads), :default_order => 'desc') %>
<% if @memo.attachments.any?%> - <% options = {:author => true} %> - <%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options} %> + <%# options = {:author => true} %> + <%= link_to_memo_attachments @memo, :author => true %> + <%#= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options} %> <% end %>
diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb index ddb60e109..dba9b52e7 100644 --- a/app/views/messages/show.html.erb +++ b/app/views/messages/show.html.erb @@ -96,7 +96,9 @@