课程动态和首页动态中的作业动态实现二级回复
This commit is contained in:
parent
644e097dc8
commit
1eb41478b2
|
@ -95,7 +95,13 @@ class UsersController < ApplicationController
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when 'HomeworkCommon'
|
when 'HomeworkCommon'
|
||||||
@reply = JournalsForMessage.find params[:reply_id]
|
@reply = JournalsForMessage.find params[:reply_id]
|
||||||
|
if params[:user_activity_id]
|
||||||
|
@user_activity_id = params[:user_activity_id]
|
||||||
|
else
|
||||||
|
@user_activity_id = -1
|
||||||
|
end
|
||||||
@is_in_course = params[:is_in_course]
|
@is_in_course = params[:is_in_course]
|
||||||
|
@course_activity = params[:course_activity].to_i
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -317,7 +317,9 @@ class WordsController < ApplicationController
|
||||||
update_org_activity(@homework_common.class,@homework_common.id)
|
update_org_activity(@homework_common.class,@homework_common.id)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js{
|
format.js{
|
||||||
@is_in_course = params[:is_in_course]
|
@user_activity_id = params[:user_activity_id].to_i
|
||||||
|
@is_in_course = params[:is_in_course].to_i
|
||||||
|
@course_activity = params[:course_activity].to_i
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
|
@ -276,7 +276,8 @@
|
||||||
<% count=activity.journals_for_messages.count %>
|
<% count=activity.journals_for_messages.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<div class="homepagePostReplyBanner">
|
<div class="homepagePostReplyBanner">
|
||||||
<div class="homepagePostReplyBannerCount">回复
|
<div class="homepagePostReplyBannerCount"><span>回复</span>
|
||||||
|
<span class="reply_iconup" > ︿</span>
|
||||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||||
<span id="praise_count_<%=user_activity_id %>">
|
<span id="praise_count_<%=user_activity_id %>">
|
||||||
<% if activity.user == User.current %>
|
<% if activity.user == User.current %>
|
||||||
|
@ -318,23 +319,60 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to comment.try(:user).try(:realname), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %>
|
<%= link_to comment.try(:user).try(:realname), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= format_time(comment.created_on) %>
|
<%= time_from_now(comment.created_on) %>
|
||||||
<span id="reply_praise_count_<%=comment.id %>">
|
|
||||||
<% if comment.user == User.current %>
|
|
||||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
|
||||||
<% else %>
|
|
||||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
<div id="message_edit_<%=comment.id %>" style="display: none" class="mr10 fr">
|
|
||||||
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
|
|
||||||
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity},
|
|
||||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<% unless comment.m_parent_id.nil? %>
|
||||||
|
<% parents_rely = [] %>
|
||||||
|
<% parents_rely = get_reply_parents parents_rely, comment %>
|
||||||
|
<% length = parents_rely.length %>
|
||||||
|
<div id="comment_reply_<%=comment.id %>">
|
||||||
|
<% if length <= 3 %>
|
||||||
|
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %>
|
||||||
|
<% else %>
|
||||||
|
<div class="orig_cont clearfix">
|
||||||
|
<div class="orig_cont clearfix">
|
||||||
|
<div id="comment_reply_<%=parents_rely[length - 1].id %>">
|
||||||
|
<%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
|
||||||
|
</div>
|
||||||
|
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
|
||||||
|
</div>
|
||||||
|
<div class="orig_cont_hide clearfix"><span class="orig_icon" >↓ </span><span class="orig_icon" style="display:none;" > ↑</span><%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment),:remote=>true %></div>
|
||||||
|
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||||
<%= comment.notes.html_safe %></div>
|
<%= comment.notes.html_safe %></div>
|
||||||
|
<div class="orig_reply mb10 mt-10">
|
||||||
|
<div class="reply">
|
||||||
|
<span class="reply-right">
|
||||||
|
<span id="reply_praise_count_<%=comment.id %>">
|
||||||
|
<% if comment.user == User.current %>
|
||||||
|
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||||
|
<% else %>
|
||||||
|
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<span style="position: relative" class="fr mr20">
|
||||||
|
<%= link_to(
|
||||||
|
l(:button_reply),
|
||||||
|
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity},
|
||||||
|
:remote => true,
|
||||||
|
:method => 'get',
|
||||||
|
:title => l(:button_reply)) %>
|
||||||
|
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||||
|
</span>
|
||||||
|
<!--<a action-type="reply" href="javascript:;" poped="false" class="fr mr20 linkGrey3" title="回复">回复</a>-->
|
||||||
|
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
|
||||||
|
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity},
|
||||||
|
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p id="reply_message_<%= comment.id%>"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -285,7 +285,8 @@
|
||||||
<% count=activity.journals_for_messages.count %>
|
<% count=activity.journals_for_messages.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<div class="homepagePostReplyBanner">
|
<div class="homepagePostReplyBanner">
|
||||||
<div class="homepagePostReplyBannerCount">回复
|
<div class="homepagePostReplyBannerCount"><span>回复</span>
|
||||||
|
<span class="reply_iconup" > ︿</span>
|
||||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||||
<span id="praise_count_<%=user_activity_id %>">
|
<span id="praise_count_<%=user_activity_id %>">
|
||||||
<% if activity.user == User.current %>
|
<% if activity.user == User.current %>
|
||||||
|
@ -327,24 +328,60 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= format_time(comment.created_on) %>
|
<%= time_from_now(comment.created_on) %>
|
||||||
<span id="reply_praise_count_<%=comment.id %>">
|
|
||||||
<% if comment.user == User.current %>
|
|
||||||
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
|
||||||
<% else %>
|
|
||||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
<div id="message_edit_<%=comment.id %>" style="display: none" class="mr10 fr">
|
|
||||||
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
|
|
||||||
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity},
|
|
||||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "replyGrey fr ml10", :title => l(:button_delete)) %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<% unless comment.m_parent_id.nil? %>
|
||||||
|
<% parents_rely = [] %>
|
||||||
|
<% parents_rely = get_reply_parents parents_rely, comment %>
|
||||||
|
<% length = parents_rely.length %>
|
||||||
|
<div id="comment_reply_<%=comment.id %>">
|
||||||
|
<% if length <= 3 %>
|
||||||
|
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %>
|
||||||
|
<% else %>
|
||||||
|
<div class="orig_cont clearfix">
|
||||||
|
<div class="orig_cont clearfix">
|
||||||
|
<div id="comment_reply_<%=parents_rely[length - 1].id %>">
|
||||||
|
<%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
|
||||||
|
</div>
|
||||||
|
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
|
||||||
|
</div>
|
||||||
|
<div class="orig_cont_hide clearfix"><span class="orig_icon" >↓ </span><span class="orig_icon" style="display:none;" > ↑</span><%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment),:remote=>true %></div>
|
||||||
|
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||||
<%= comment.notes.html_safe %></div>
|
<%= comment.notes.html_safe %></div>
|
||||||
|
<div class="orig_reply mb10 mt-10">
|
||||||
|
<div class="reply">
|
||||||
|
<span class="reply-right">
|
||||||
|
<span id="reply_praise_count_<%=comment.id %>">
|
||||||
|
<% if comment.user == User.current %>
|
||||||
|
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(comment) > 0 ? "(#{get_praise_num(comment)})" : "" %></span></span>
|
||||||
|
<% else %>
|
||||||
|
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<span style="position: relative" class="fr mr20">
|
||||||
|
<%= link_to(
|
||||||
|
l(:button_reply),
|
||||||
|
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity},
|
||||||
|
:remote => true,
|
||||||
|
:method => 'get',
|
||||||
|
:title => l(:button_reply)) %>
|
||||||
|
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||||
|
</span>
|
||||||
|
<!--<a action-type="reply" href="javascript:;" poped="false" class="fr mr20 linkGrey3" title="回复">回复</a>-->
|
||||||
|
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
|
||||||
|
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => -1, :user_activity_id => user_activity_id, :course_activity=>course_activity},
|
||||||
|
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p id="reply_message_<%= comment.id%>"></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
<div nhname='new_message_<%= reply.id%>'>
|
<div nhname='new_message_<%= reply.id%>'>
|
||||||
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %>
|
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %>
|
||||||
<input type="hidden" name="is_in_course" value=<%=@is_in_course %>>
|
<input type="hidden" name="is_in_course" value=<%=@is_in_course %>>
|
||||||
|
<input type="hidden" name="user_activity_id" value=<%=@user_activity_id %>>
|
||||||
|
<input type="hidden" name="course_activity" value=<%=@course_activity %>>
|
||||||
<input type="hidden" name="reply[subject]" id="reply_subject">
|
<input type="hidden" name="reply[subject]" id="reply_subject">
|
||||||
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
<div nhname='toolbar_container_<%= reply.id%>'></div>
|
||||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>
|
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></textarea>
|
||||||
|
|
|
@ -373,7 +373,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', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course},
|
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course, :course_activity => -1},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:method => 'get',
|
:method => 'get',
|
||||||
:title => l(:button_reply)) %>
|
:title => l(:button_reply)) %>
|
||||||
|
@ -381,7 +381,7 @@
|
||||||
</span>
|
</span>
|
||||||
<!--<a action-type="reply" href="javascript:;" poped="false" class="fr mr20 linkGrey3" title="回复">回复</a>-->
|
<!--<a action-type="reply" href="javascript:;" poped="false" class="fr mr20 linkGrey3" title="回复">回复</a>-->
|
||||||
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
|
<% if User.current.admin? ||is_teacher || comment.user == User.current%>
|
||||||
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course,:course_activity=>-1},
|
<%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user,:is_in_course => is_in_course, :course_activity => -1},
|
||||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
|
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<% if @is_in_course %>
|
<% if @user_activity_id != -1 %>
|
||||||
|
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>");
|
||||||
|
sd_create_editor_from_data(<%= @user_activity_id%>,"","100%", "UserActivity");
|
||||||
|
<% else %>
|
||||||
$("#homework_common_<%= @homework_common.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>");
|
$("#homework_common_<%= @homework_common.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>");
|
||||||
sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "HomeworkCommon");
|
sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "HomeworkCommon");
|
||||||
<% end %>
|
<% end %>
|
Loading…
Reference in New Issue