动态回复默认显示3个,“收起回复”、“展开更多”后去掉回复数

This commit is contained in:
cxt 2015-10-14 14:19:59 +08:00
parent ea66ca5e00
commit 20ff1430fc
12 changed files with 29 additions and 24 deletions

View File

@ -26,14 +26,15 @@
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复(' + btn.data('count') + ')');
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多(' + btn.data('count') + ')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}

View File

@ -209,11 +209,11 @@
btn.click(function(){
if($(this).data('init')=='0'){
$(this).data('init',1);
$(this).html('收起回复('+$(this).data('count')+')');
$(this).html('收起回复');
target.show();
}else{
$(this).data('init',0);
$(this).html('展开回复('+$(this).data('count')+')');
$(this).html('展开回复'+$(this).data('count')+')');
target.hide();
target.eq(0).show();
target.eq(1).show();

View File

@ -56,14 +56,15 @@
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复(' + btn.data('count') + ')');
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多(' + btn.data('count') + ')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}

View File

@ -17,14 +17,15 @@
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复('+btn.data('count')+')');
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多('+btn.data('count')+')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
$(function() {

View File

@ -12,14 +12,15 @@
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复('+btn.data('count')+')');
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多('+btn.data('count')+')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
$(function() {

View File

@ -34,7 +34,7 @@
回复(<%= count %>
</div>
<div class="homepagePostReplyBannerTime"></div>
<%if count>2 %>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
@ -49,7 +49,7 @@
<ul>
<% course.journals_for_messages.where('m_parent_id IS NULL').reorder("created_on desc").each do |comment| %>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div>

View File

@ -58,7 +58,7 @@
<%= count %>
)</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<%if count > 2 %>
<%if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
@ -74,7 +74,7 @@
<ul>
<% activity.children.reorder("created_on desc").each do |reply|%>
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
</div>

View File

@ -32,7 +32,7 @@
回复(<%= count %>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>2 %>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
@ -47,7 +47,7 @@
<ul>
<% activity.comments.reorder("created_on desc").each do |comment| %>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.author_id), :alt => "用户头像" %>
</div>

View File

@ -69,7 +69,7 @@
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
<div class="homepagePostReplyBannerCount" onclick="expand_reply_input('#reply_input_<%= user_activity_id %>');">回复(<%= count %></div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<% if count > 2 %>
<% if count > 3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
展开更多
@ -84,7 +84,7 @@
<ul>
<% activity.journals.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %>
</div>

View File

@ -49,7 +49,7 @@
<%=count %>
)</div>
<div class="homepagePostReplyBannerTime"><%#=format_date(activity.updated_on)%></div>
<%if count>2 %>
<%if count>3 %>
<div class="homepagePostReplyBannerMore"><a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >展开更多</a></div>
<% end %>
</div>
@ -61,7 +61,7 @@
<ul>
<% activity.children.reorder("created_on desc").each do |reply| %>
<% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.author_id), :alt => "用户头像" %>
</div>

View File

@ -20,14 +20,15 @@
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复('+btn.data('count')+')');
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多('+btn.data('count')+')');
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}

View File

@ -32,7 +32,7 @@
回复(<%= count %>
</div>
<div class="homepagePostReplyBannerTime"></div>
<%if count>2 %>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
@ -47,7 +47,7 @@
<ul>
<% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
<% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 2 ? 'none' : '' %>">
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
</div>