将内容省略显示的固定字数改为传参
This commit is contained in:
parent
d32e07bda9
commit
34ea7662b2
|
@ -42,7 +42,7 @@
|
|||
<% else %>
|
||||
<% content = activity.parent.content %>
|
||||
<% end %>
|
||||
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54} %></p>
|
||||
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>100} %></p>
|
||||
</div>
|
||||
<div class="ml15 mt10">
|
||||
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="massages-content ml15">
|
||||
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54} %></p>
|
||||
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>activity.description, :maxheight=>54, :maxwordsnum=>100} %></p>
|
||||
</div>
|
||||
<div class="ml15 mt10">
|
||||
<span class="grayTxt">发布时间:<%= format_time(activity.created_on) %></span>
|
||||
|
|
|
@ -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 %>);
|
||||
});
|
||||
</script>
|
|
@ -42,7 +42,7 @@
|
|||
<% else %>
|
||||
<% content = activity.parent.content %>
|
||||
<% end %>
|
||||
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54 } %></p>
|
||||
<p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>100} %></p>
|
||||
</div>
|
||||
<div class="ml15 mt10">
|
||||
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue