diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index be1c77aa2..fdd33485d 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -20,7 +20,12 @@ class PraiseTreadController < ApplicationController @obj_type = params[:obj_type] #@horizontal = params[:horizontal].downcase == "false" ? false:true @obj = find_object_by_type_and_id(@obj_type,@obj_id) - unless @obj.author_id == User.current.id + if @obj.respond_to?("author_id") + author_id = @obj.author_id + elsif @obj.respond_to?("user_id") + author_id = @obj.user_id + end + unless author_id == User.current.id praise_tread_plus(@obj_type,@obj_id,1) end respond_to do |format| @@ -102,6 +107,10 @@ class PraiseTreadController < ApplicationController @obj = Memo.find_by_id(id) when 'Message' @obj = Message.find_by_id(id) + when 'HomeworkCommon' + @obj = HomeworkCommon.find_by_id(id) + when 'JournalsForMessage' + @obj = JournalsForMessage.find_by_id(id) end return @obj end diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb index 4f2a7b662..7f032d704 100644 --- a/app/views/organizations/_org_course_homework.html.erb +++ b/app/views/organizations/_org_course_homework.html.erb @@ -223,10 +223,16 @@ <% count=activity.journals_for_messages.count %>
-
-
-
- 回复(<%= count %>) +
+
回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> +
<%if count>3 %> @@ -261,6 +267,19 @@ <%= 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 %> + +
<%= comment.notes.html_safe %>
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb index 7c6959935..23215281a 100644 --- a/app/views/users/_course_homework.html.erb +++ b/app/views/users/_course_homework.html.erb @@ -223,10 +223,16 @@ <% count=activity.journals_for_messages.count %>
-
-
-
- 回复(<%= count %>) +
+
回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if activity.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%> + <% end %> +
<%if count>3 %> @@ -261,12 +267,20 @@ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> <%= format_time(comment.created_on) %> -
<%= comment.notes.html_safe %>
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb index 85e426e92..1362cac5e 100644 --- a/app/views/users/_user_homework_detail.html.erb +++ b/app/views/users/_user_homework_detail.html.erb @@ -226,10 +226,16 @@ <% count=homework_common.journals_for_messages.count %>
-
-
-
- 回复(<%= count %>) +
+
回复 + <%= count>0 ? "(#{count})" : "" %> + + <% if homework_common.user == User.current %> + + <% else %> + <%=render :partial=> "praise_tread/praise", :locals => {:activity=>homework_common, :user_activity_id=>homework_common.id,:type=>"activity"}%> + <% end %> +
<%if count>3 %> @@ -263,8 +269,14 @@ <% else %> <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <% end %> - <%= format_time(comment.created_on) %> -