diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 38b97a501..b63f1071b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -127,7 +127,7 @@ module ApplicationHelper # * :text - Link text (default to attachment filename) # * :download - Force download (default: false) def link_to_attachment(attachment, options={}) - text = h(truncate(options.delete(:text) || attachment.filename, length: 60, omission: '...')) + text = h(truncate(options.delete(:text) || attachment.filename, length: 25, omission: '...')) route_method = options.delete(:download) ? :download_named_attachment_path : :named_attachment_path html_options = options.slice!(:only_path) url = send(route_method, attachment, attachment.filename, options) diff --git a/app/views/attachments/_links.html.erb b/app/views/attachments/_links.html.erb index 4c4065d09..2b12b21d1 100644 --- a/app/views/attachments/_links.html.erb +++ b/app/views/attachments/_links.html.erb @@ -11,7 +11,9 @@ :id => attachment, :filename => attachment.filename%> <% end %> - <%= h(" - #{attachment.description}") unless attachment.description.blank? %> + + <%= h(truncate(" - #{attachment.description}", length: 20, omission: '...')) unless attachment.description.blank? %> + (<%= number_to_human_size attachment.filesize %>) <% if options[:deletable] %> <% if attachment.container_type == 'HomeworkAttach' %>