diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0dd947be4..01d87374c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -95,7 +95,13 @@ class UsersController < ApplicationController case params[:type] when 'HomeworkCommon' @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] + @course_activity = params[:course_activity].to_i end respond_to do |format| format.js diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index e17f03c38..fa084e349 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -317,7 +317,9 @@ class WordsController < ApplicationController update_org_activity(@homework_common.class,@homework_common.id) respond_to do |format| 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 else diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 19cdcf2f1..179e4678e 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -276,7 +276,8 @@ <% count=activity.journals_for_messages.count %>
-
回复 +
回复 + ︿ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> @@ -318,23 +319,60 @@ <% else %> <%= link_to comment.try(:user).try(:realname), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> - <%= format_time(comment.created_on) %> - - <% if comment.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - <% end %> - - + <%= time_from_now(comment.created_on) %>
+ <% unless comment.m_parent_id.nil? %> + <% parents_rely = [] %> + <% parents_rely = get_reply_parents parents_rely, comment %> + <% length = parents_rely.length %> +
+ <% if length <= 3 %> + <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %> + <% else %> +
+
+
+ <%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %> +
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %> +
+
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment),:remote=>true %>
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %> +
+ <% end %> +
+ <% end %>
<%= comment.notes.html_safe %>
+
+
+ + + <% if comment.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + + + <%= 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)) %> + + + + <% 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 %> + +
+
+
+

diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index b6ea36de5..a96ae5d74 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -285,7 +285,8 @@ <% count=activity.journals_for_messages.count %>
-
回复 +
回复 + ︿ <%= count>0 ? "(#{count})" : "" %> <% if activity.user == User.current %> @@ -327,24 +328,60 @@ <% else %> <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> - <%= format_time(comment.created_on) %> - - <% if comment.user == User.current %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> - <% end %> - - - + <%= time_from_now(comment.created_on) %>
+ <% unless comment.m_parent_id.nil? %> + <% parents_rely = [] %> + <% parents_rely = get_reply_parents parents_rely, comment %> + <% length = parents_rely.length %> +
+ <% if length <= 3 %> + <%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent} %> + <% else %> +
+
+
+ <%=render :partial => 'users/comment_reply', :locals => {:comment => parents_rely[length - 1]} %> +
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %> +
+
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment),:remote=>true %>
+ <%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %> +
+ <% end %> +
+ <% end %>
<%= comment.notes.html_safe %>
+
+
+ + + <% if comment.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%> + <% end %> + + + <%= 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)) %> + + + + <% 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 %> + +
+
+
+

diff --git a/app/views/users/_reply_to.html.erb b/app/views/users/_reply_to.html.erb index ccfc07db2..30f4e3542 100644 --- a/app/views/users/_reply_to.html.erb +++ b/app/views/users/_reply_to.html.erb @@ -4,6 +4,8 @@
<%= form_for('new_form',:url => {:controller => 'words', :action => 'reply_to_homework', :id => reply.id},:method => "post", :remote => true) do |f| %> > + > + >
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 30bec6685..fde67f472 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -373,7 +373,7 @@ <%= link_to( 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, :method => 'get', :title => l(:button_reply)) %> @@ -381,7 +381,7 @@ <% 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)) %> <% end %> diff --git a/app/views/words/reply_to_homework.js.erb b/app/views/words/reply_to_homework.js.erb index 85275277a..7da72fa54 100644 --- a/app/views/words/reply_to_homework.js.erb +++ b/app/views/words/reply_to_homework.js.erb @@ -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}) %>"); sd_create_editor_from_data(<%= @homework_common.id%>,"","100%", "HomeworkCommon"); <% end %> \ No newline at end of file