点击展开回复

This commit is contained in:
cxt 2016-11-25 18:01:50 +08:00
parent ebda1d7d54
commit 8a52e136cf
15 changed files with 47 additions and 40 deletions

View File

@ -145,7 +145,7 @@ class UsersController < ApplicationController
case params[:type] case params[:type]
when 'JournalsForMessage' when 'JournalsForMessage'
@comment = JournalsForMessage.find params[:comment].to_i @comment = JournalsForMessage.find params[:comment].to_i
when 'Message' when 'Message','is_project_message'
@comment = Message.find params[:comment].to_i @comment = Message.find params[:comment].to_i
when 'BlogComment' when 'BlogComment'
@comment = BlogComment.find params[:comment].to_i @comment = BlogComment.find params[:comment].to_i
@ -153,9 +153,11 @@ class UsersController < ApplicationController
@comment = OrgDocumentComment.find params[:comment].to_i @comment = OrgDocumentComment.find params[:comment].to_i
when 'Comment' when 'Comment'
@comment = Comment.find params[:comment].to_i @comment = Comment.find params[:comment].to_i
when 'Journal' when 'Journal','is_project_issue'
@comment = Journal.find params[:comment].to_i @comment = Journal.find params[:comment].to_i
end end
@user_activity_id = params[:user_activity_id]
@parent_id = params[:parent_id] if params[:parent_id]
end end
#二级回复 #二级回复
@ -214,6 +216,7 @@ class UsersController < ApplicationController
def reply_to_comment def reply_to_comment
@type = params[:type] @type = params[:type]
@reply = get_reply_by_type @type, params[:reply_id] @reply = get_reply_by_type @type, params[:reply_id]
@parent_id = params[:parent_id] if params[:parent_id]
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]
@is_project = params[:is_project] if params[:is_project] @is_project = params[:is_project] if params[:is_project]
respond_to do |format| respond_to do |format|

View File

@ -25,7 +25,7 @@
<span style="position: relative" class="fr mr20"> <span style="position: relative" class="fr mr20">
<%= link_to( <%= link_to(
l(:button_reply), l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Message', :user_activity_id => user_activity_id, :is_project => true}, {:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Message', :user_activity_id => user_activity_id, :parent_id => parent_id, :is_project => true},
:remote => true, :remote => true,
:method => 'get', :method => 'get',
:title => l(:button_reply)) %> :title => l(:button_reply)) %>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<% if !comment.parent.nil? && !comment.parent.parent.nil? %> <% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<div> <div>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>
<% end %> <% end %>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<% unless comment.parent.nil? %> <% unless comment.parent.nil? %>
<div> <div>
<%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>
<% end %> <% end %>
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => comment, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>

View File

@ -25,7 +25,7 @@
<span style="position: relative" class="fr mr20"> <span style="position: relative" class="fr mr20">
<%= link_to( <%= link_to(
l(:button_reply), l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :is_project => true}, {:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => 'Issue', :user_activity_id => user_activity_id, :parent_id => parent_id, :is_project => true},
:remote => true, :remote => true,
:method => 'get', :method => 'get',
:title => l(:button_reply)) %> :title => l(:button_reply)) %>

View File

@ -8,18 +8,18 @@
<% length = parents_rely.length %> <% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>"> <div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %> <% if length <= 2 %>
<%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %> <% else %>
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<div class="orig_cont_hide_issue clearfix"> <div class="orig_cont_hide_issue clearfix">
<span class="orig_icon" >&darr; </span> <span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span> <span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class), :remote=>true, :class => 'linkBlue2' %> <%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => 'is_project_issue', :user_activity_id => user_activity_id, :parent_id => comment.id), :remote=>true, :class => 'linkBlue2' %>
</div> </div>
<%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/project_issue_comments_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -8,18 +8,18 @@
<% length = parents_rely.length %> <% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>"> <div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %> <% if length <= 2 %>
<%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/journal_comment_reply', :locals => {:comment => comment.parent, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %> <% else %>
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<div class="orig_cont_hide_issue clearfix"> <div class="orig_cont_hide_issue clearfix">
<span class="orig_icon" >&darr; </span> <span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span> <span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class), :remote=>true, :class => 'linkBlue2' %> <%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => 'is_project_message', :user_activity_id => user_activity_id, :parent_id => comment.id), :remote=>true, :class => 'linkBlue2' %>
</div> </div>
<%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id} %> <%=render :partial => 'projects/comment_reply_detail', :locals => {:comment => parents_rely[0], :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -28,11 +28,11 @@
<div class="<%= score_color st.student_score%> student_score_info pr"> <div class="<%= score_color st.student_score%> student_score_info pr">
<% if st.student_score.nil? %> <% if st.student_score.nil? %>
<% if @homework.homework_detail_manual.comment_status == 2 && st.student_works_evaluation_distributions.count != 0 %> <% if @homework.homework_detail_manual.comment_status == 2 && st.student_works_evaluation_distributions.count != 0 %>
<span title="该作品未被匿评">待匿评</span> <span title="该作品正在匿评中">待匿评</span>
<% elsif @homework.homework_detail_manual.comment_status == 3 && st.student_works_evaluation_distributions.count != 0 %> <% elsif @homework.homework_detail_manual.comment_status == 3 && st.student_works_evaluation_distributions.count != 0 %>
<span title="该作品未被匿评">缺评</span> <span title="该作品未被匿评">缺评</span>
<% else %> <% else %>
<span title="该作品未匿评">未参与</span> <span title="该作品未参与匿评">未参与</span>
<% end %> <% end %>
<% else %> <% else %>
<%= format("%.1f", st.student_score) %> <%= format("%.1f", st.student_score) %>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<% unless comment.parent.nil? %> <% unless comment.parent.nil? %>
<div> <div>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>
<% end %> <% end %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>

View File

@ -28,7 +28,7 @@
<span style="position: relative" class="fr mr20"> <span style="position: relative" class="fr mr20">
<%= link_to( <%= link_to(
l(:button_reply), l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id}, {:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id},
:remote => true, :remote => true,
:method => 'get', :method => 'get',
:title => l(:button_reply)) %> :title => l(:button_reply)) %>

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<% if !comment.parent.nil? && !comment.parent.parent.nil? %> <% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<div> <div>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>
<% end %> <% end %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div> </div>

View File

@ -8,21 +8,21 @@
<% length = parents_rely.length %> <% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>"> <div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %> <% if length <= 2 %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %> <% else %>
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<!--<div>--> <!--<div>-->
<!--<%#=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>--> <!--<%#=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>-->
<!--</div>--> <!--</div>-->
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<div class="orig_cont_hide clearfix"> <div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span> <span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span> <span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true, :class => 'linkBlue2' %> <%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => user_activity_id, :parent_id => comment.id),:remote=>true, :class => 'linkBlue2' %>
</div> </div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -8,21 +8,21 @@
<% length = parents_rely.length %> <% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>"> <div id="comment_reply_<%=comment.id %>">
<% if length <= 2 %> <% if length <= 2 %>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %> <% else %>
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<div class="orig_cont clearfix"> <div class="orig_cont clearfix">
<!--<div>--> <!--<div>-->
<!--<%#=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %>--> <!--<%#=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %>-->
<!--</div>--> <!--</div>-->
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 1], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<div class="orig_cont_hide clearfix"> <div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span> <span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span> <span class="orig_icon" style="display:none;" > &uarr;</span><span class="">已经隐藏<%=(length - 2).to_s %>个楼层</span>
<%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class), :remote=>true, :class => 'linkBlue2' %> <%= link_to '[点击展开]', show_all_replies_users_path(:comment => comment, :type => comment.class, :user_activity_id => user_activity_id, :parent_id => comment.id), :remote=>true, :class => 'linkBlue2' %>
</div> </div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id} %> <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0], :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
</div> </div>
<% end %> <% end %>
</div> </div>

View File

@ -1,10 +1,10 @@
if($("#reply_message_<%= @reply.id%>").length > 0) { if($("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id%>").length > 0) {
$("#reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'users/reply_to_comment', :locals => {:reply => @reply}) %>"); $("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'users/reply_to_comment', :locals => {:reply => @reply}) %>");
$("#reply_iconup_<%=@reply.id %>").show(); $("#comment_reply_<%=@parent_id %> #reply_iconup_<%=@reply.id %>").show();
$(function(){ $(function(){
sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%=@reply.class.to_s%>"); sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%=@reply.class.to_s%>");
}); });
}else if($("#reply_to_message_<%= @reply.id%>").length >0) { }else if($("#comment_reply_<%=@parent_id %> #reply_to_message_<%= @reply.id%>").length >0) {
$("#reply_to_message_<%= @reply.id%>").replaceWith("<p id='reply_message_<%= @reply.id%>'></p>"); $("#comment_reply_<%=@parent_id %> #reply_to_message_<%= @reply.id%>").replaceWith("<p id='reply_message_<%= @reply.id%>'></p>");
$("#reply_iconup_<%=@reply.id %>").hide(); $("#comment_reply_<%=@parent_id %> #reply_iconup_<%=@reply.id %>").hide();
} }

View File

@ -1,9 +1,13 @@
<% unless @comment.parent.nil? %> <% unless @comment.parent.nil? %>
<% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %> <% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type]})%>"); $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% elsif params[:type] == 'is_project_message' %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'projects/journal_comment_reply', :locals => {:comment => @comment.parent, :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% elsif params[:type] == 'is_project_issue' %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'projects/project_issue_comments_reply', :locals => {:comment => @comment.parent, :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% elsif (@comment.class.to_s == 'Message' || @comment.class.to_s == 'BlogComment' || @comment.class.to_s == 'OrgDocumentComment') %> <% elsif (@comment.class.to_s == 'Message' || @comment.class.to_s == 'BlogComment' || @comment.class.to_s == 'OrgDocumentComment') %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type]})%>"); $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% else %> <% else %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent, :type => params[:type]})%>"); $('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent, :type => params[:type], :user_activity_id => @user_activity_id, :parent_id => @parent_id})%>");
<% end %> <% end %>
<% end %> <% end %>