From 0ab7bfcda979b8ff11b8c956e7a56689ba0a8eff Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Wed, 17 Sep 2014 14:14:17 +0800
Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E4=B8=8A=E4=BC=A0=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E5=90=8D=E3=80=81=E6=96=87=E4=BB=B6=E6=8F=8F=E8=BF=B0?=
=?UTF-8?q?=E9=95=BF=E5=BA=A6=20#1252?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/application_helper.rb | 2 +-
app/views/attachments/_links.html.erb | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
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' %>