From 34ea7662b27d7d6eed53d5ada6c122d002110aed Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 6 May 2016 17:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=86=85=E5=AE=B9=E7=9C=81=E7=95=A5?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E5=9B=BA=E5=AE=9A=E5=AD=97=E6=95=B0?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_course_boardlist.html.erb | 2 +- app/views/users/_course_newslist.html.erb | 2 +- app/views/users/_intro_content_ex.html.erb | 2 +- app/views/users/_project_boardlist.html.erb | 2 +- public/javascripts/application.js | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/users/_course_boardlist.html.erb b/app/views/users/_course_boardlist.html.erb index ce5881a4a..c92d117ee 100644 --- a/app/views/users/_course_boardlist.html.erb +++ b/app/views/users/_course_boardlist.html.erb @@ -42,7 +42,7 @@ <% else %> <% content = activity.parent.content %> <% end %> -

<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54} %>

+

<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>100} %>

发帖时间:<%= format_time(activity.created_on) %> diff --git a/app/views/users/_course_newslist.html.erb b/app/views/users/_course_newslist.html.erb index ca782b0d5..ff99e116e 100644 --- a/app/views/users/_course_newslist.html.erb +++ b/app/views/users/_course_newslist.html.erb @@ -30,7 +30,7 @@
-

<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54} %>

+

<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54, :maxwordsnum=>100} %>

发布时间:<%= format_time(activity.created_on) %> diff --git a/app/views/users/_intro_content_ex.html.erb b/app/views/users/_intro_content_ex.html.erb index ae88fc6ac..e3baf3fe2 100644 --- a/app/views/users/_intro_content_ex.html.erb +++ b/app/views/users/_intro_content_ex.html.erb @@ -12,6 +12,6 @@ $("#activity_description_<%= user_activity_id%>").css("max-height", heightType + "px"); } - description_showwords_ellipsis(<%=user_activity_id %>); + description_showwords_ellipsis(<%=user_activity_id %>,<%= maxwordsnum %>); }); \ No newline at end of file diff --git a/app/views/users/_project_boardlist.html.erb b/app/views/users/_project_boardlist.html.erb index 8a306523f..5f61d26ef 100644 --- a/app/views/users/_project_boardlist.html.erb +++ b/app/views/users/_project_boardlist.html.erb @@ -42,7 +42,7 @@ <% else %> <% content = activity.parent.content %> <% end %> -

<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54 } %>

+

<%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>100} %>

发帖时间:<%= format_time(activity.created_on) %> diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 7c52bae35..aa445f817 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1240,7 +1240,7 @@ function expand_reply(container,btnid){ } //by yk 列表描述将文字和起来去掉空格多于100就显示省略号 -function description_showwords_ellipsis(id){ +function description_showwords_ellipsis(id,num){ var str = ""; $("#intro_content_"+id).each(function () { str = str + $(this).text(); @@ -1249,8 +1249,8 @@ function description_showwords_ellipsis(id){ //去掉空格 str = str.replace(/\s/gi,''); - if(str.length > 100){ - str = str.substring(0,100)+"..."; + if(str.length > num){ + str = str.substring(0,num)+"..."; } $("#intro_content_"+id).html(str);