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);