diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b1aae9b26..d14bccc4e 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -507,7 +507,8 @@ class ApplicationController < ActionController::Base
# render_404
# end
- def self.model_object(model)
+ def self.
+ model_object(model)
self.model_object = model
end
diff --git a/app/controllers/blog_comments_controller.rb b/app/controllers/blog_comments_controller.rb
index dcab1b360..dcd549d76 100644
--- a/app/controllers/blog_comments_controller.rb
+++ b/app/controllers/blog_comments_controller.rb
@@ -144,7 +144,7 @@ class BlogCommentsController < ApplicationController
if params[:parent_id]
@blogComment.content = params[:blog_comment][:content]
parent = BlogComment.find params[:parent_id]
- @blogComment.reply_id = params[:reply_id]
+ @blogComment.reply_id = params[:id]
parent.children << @blogComment
else
@quote = params[:quote][:quote] || ""
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index 5966b310f..9226b904c 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -19,8 +19,8 @@ class CommentsController < ApplicationController
default_search_scope :news
include ApplicationHelper
model_object News
- before_filter :find_model_object
- before_filter :find_project_from_association
+ before_filter :find_model_object, :except => [:reply, :quote]
+ before_filter :find_project_from_association, :except => [:reply, :quote]
before_filter :authorize
def create
@@ -73,7 +73,46 @@ class CommentsController < ApplicationController
def destroy
@news.comments.find(params[:comment_id]).destroy
- redirect_to news_url(@news)
+ if params[:user_activity_id]
+ @user_activity_id = params[:user_activity_id]
+ respond_to do |format|
+ format.js
+ return
+ end
+ else
+ redirect_to news_url(@news)
+ end
+ end
+
+ def quote
+ @comment = Comment.find(params[:id])
+ respond_to do | format|
+ format.js
+ end
+ end
+
+ def reply
+ comment = Comment.find(params[:id])
+ @news = News.find comment.commented_id
+ new_comment = @news.comments.build(:author_id => User.current.id, :reply_id => params[:id], :comments => params[:content], :parent_id => comment.id)
+ @user_activity_id = params[:user_activity_id]
+ if new_comment.save
+ update_course_activity(@news.class,@news.id)
+ update_user_activity(@news.class,@news.id)
+ update_org_activity(@news.class,@news.id)
+ if @user_activity_id
+ respond_to do |format|
+ format.js
+ return
+ end
+ else
+ respond_to do |format|
+ format.html {
+ redirect_to news_path(@news)
+ }
+ end
+ end
+ end
end
private
@@ -87,5 +126,4 @@ class CommentsController < ApplicationController
@news
end
-
end
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index f5ad89832..160383e92 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -140,15 +140,15 @@ class MessagesController < ApplicationController
def reply
if params[:parent_id]
parent = Message.find params[:parent_id]
+ @topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i)
@reply = Message.new
@reply.author = User.current
@reply.board = parent.board
@reply.content = params[:content]
- @reply.subject = "RE: #{parent.subject}"
- @reply.reply_id = params[:reply_id]
+ @reply.subject = "RE: #{@topic.subject}"
+ @reply.reply_id = params[:id]
# @reply.reply_id = params[:id]
parent.children << @reply
- @topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i)
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@is_course = params[:is_course] if params[:is_course]
@is_board = params[:is_board] if params[:is_board]
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index ec95ce38b..6b9e8f4c9 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -94,6 +94,10 @@ class UsersController < ApplicationController
@comment = Message.find params[:comment].to_i
when 'BlogComment'
@comment = BlogComment.find params[:comment].to_i
+ when 'BlogComment'
+ @comment = OrgDocumentComment.find params[:comment].to_i
+ when 'Comment'
+ @comment = Comment.find params[:comment].to_i
end
end
@@ -133,6 +137,11 @@ class UsersController < ApplicationController
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'OrgDocumentComment'
+ when 'News'
+ @reply = Comment.find params[:reply_id]
+ @user_activity_id = params[:user_activity_id]
+ @activity_id = params[:activity_id]
+ @type = 'News'
end
respond_to do |format|
format.js
@@ -3306,6 +3315,8 @@ class UsersController < ApplicationController
when 'News'
obj = News.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")
+ @type = 'News'
+ @user_activity_id = params[:div_id].to_i if params[:div_id]
when 'Syllabus'
obj = Syllabus.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")
@@ -3327,6 +3338,7 @@ class UsersController < ApplicationController
@journals = get_all_children(comments, obj)
when 'HomeworkCommon'
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
+ @type = 'HomeworkCommon'
@journals = obj.journals_for_messages.reorder("created_on desc")
@is_in_course = params[:is_in_course].to_i if params[:is_in_course]
@course_activity = params[:course_activity].to_i if params[:course_activity]
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 80b52a8f4..633c9a825 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -33,10 +33,11 @@ class Comment < ActiveRecord::Base
:title=>Proc.new {|o| "RE: #{o.commented.title}" },
:url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} }
+ acts_as_tree :counter_cache => :comments_count, :order => "#{Comment.table_name}.created_on ASC"
belongs_to :commented, :polymorphic => true, :counter_cache => true,:touch => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :commented, :author, :comments
- safe_attributes 'comments'
+ safe_attributes 'comments','parent_id','reply_id','comments_count'
after_create :send_mail, :act_as_system_message, :act_as_student_score
after_destroy :down_course_score
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index a55a81e89..7782c00a0 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -162,7 +162,7 @@ class CoursesService
raise '403'
end
end
- @comments = @news.comments
+ @comments = @news.comments.reorder("created_on desc")
@comments.reverse! if current_user.wants_comments_in_reverse_order?
{:news => @news,:comments => @comments}
diff --git a/app/views/blogs/_homepage.html.erb b/app/views/blogs/_homepage.html.erb
index d5a5c0d64..a16547836 100644
--- a/app/views/blogs/_homepage.html.erb
+++ b/app/views/blogs/_homepage.html.erb
@@ -51,13 +51,13 @@
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
- <%= render :partial => 'users/blog_comment_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>
+ <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
- <%= render :partial => 'users/blog_comments_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%>
+ <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1}%>
<% end %>
diff --git a/app/views/comments/_simple_ke_reply_form.html.erb b/app/views/comments/_simple_ke_reply_form.html.erb
new file mode 100644
index 000000000..764d4a1af
--- /dev/null
+++ b/app/views/comments/_simple_ke_reply_form.html.erb
@@ -0,0 +1,20 @@
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+
+
\ No newline at end of file
diff --git a/app/views/comments/destroy.js.erb b/app/views/comments/destroy.js.erb
new file mode 100644
index 000000000..e8f425a85
--- /dev/null
+++ b/app/views/comments/destroy.js.erb
@@ -0,0 +1,10 @@
+<% if @user_activity_id %>
+ <% if @news.project_id && @news.project_id != -1 %>
+ $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
+ <% elsif @news.course_id %>
+ $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
+ <% elsif @news.org_subfield_id %>
+ $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
+ <% end %>
+<% end %>
+sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "<%=@news.class.to_s%>");
diff --git a/app/views/comments/quote.js.erb b/app/views/comments/quote.js.erb
new file mode 100644
index 000000000..cc5bc98ac
--- /dev/null
+++ b/app/views/comments/quote.js.erb
@@ -0,0 +1,8 @@
+if($("#reply_message_<%= @comment.id%>").length > 0) {
+ $("#reply_message_<%= @comment.id%>").replaceWith("<%= escape_javascript(render :partial => 'comments/simple_ke_reply_form', :locals => {:reply => @comment}) %>");
+ $(function(){
+ sd_create_editor_from_data(<%= @comment.id%>,null,"100%", "<%=@comment.class.to_s%>");
+ });
+}else if($("#reply_to_message_<%= @comment.id %>").length >0) {
+ $("#reply_to_message_<%= @comment.id%>").replaceWith("");
+}
\ No newline at end of file
diff --git a/app/views/comments/reply.js.erb b/app/views/comments/reply.js.erb
new file mode 100644
index 000000000..e8f425a85
--- /dev/null
+++ b/app/views/comments/reply.js.erb
@@ -0,0 +1,10 @@
+<% if @user_activity_id %>
+ <% if @news.project_id && @news.project_id != -1 %>
+ $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
+ <% elsif @news.course_id %>
+ $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
+ <% elsif @news.org_subfield_id %>
+ $("#user_activity_<%= @user_activity_id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
+ <% end %>
+<% end %>
+sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "<%=@news.class.to_s%>");
diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb
index fc877d809..c8068e425 100644
--- a/app/views/news/_course_show.html.erb
+++ b/app/views/news/_course_show.html.erb
@@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
+ <%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
@@ -97,97 +82,7 @@
-
-
回复
- <%= @comments.count>0 ? "(#{@comments.count})" : "" %> ▪
-
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@news, :user_activity_id=>@news.id,:type=>"activity"}%>
-
-
-
- <% unless @comments.empty? %>
-
- <% @comments.each_with_index do |reply,i| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
-
-
- <%= reply.comments.html_safe%>
-
-
- <%= format_time(reply.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if @news.commentable? %>
-
-
-
-
- <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
-
-
-
-
- <%= l(:label_cancel_with_space) %>
-
-
-
- <% end %>
-
-
-
- <% end %>
+ <%= render :partial => 'news/news_all_replies' %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
+
+
+
+ <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
+ <%= time_from_now(comment.created_on) %>
+
+ <% if !comment.parent.nil? %>
+ <% parents_rely = [] %>
+ <% parents_rely = get_reply_parents_no_root parents_rely, comment %>
+ <% length = parents_rely.length %>
+
+ <% end %>
+ <% if !comment.content_detail.blank? %>
+
+
+
+
+
+
+ <%= link_to(
+ l(:button_reply),
+ {:controller => 'comments',:action => 'quote', :id => comment},
+ :remote => true,
+ :method => 'get',
+ :title => l(:button_reply))%>
+
+
+ <%= link_to(
+ l(:button_delete),
+ {:controller => 'comments',
+ :action => 'destroy', :id => @news,
+ :comment_id => comment},
+ :method => :delete,
+ :class => 'fr mr20',
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:button_delete)
+ ) if @news.author == User.current %>
+
+
+
+
+
+ <% end %>
+
+
+
+ <% end %>
+
+
+<% end %>
+
+<% if @news.commentable? %>
+
+
+
+
+ <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
+
+
+
+
+ <%= l(:label_cancel_with_space) %>
+
+
+
+ <% end %>
+
+
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/news/_organization_show.html.erb b/app/views/news/_organization_show.html.erb
index 7eecf43ab..9790c1305 100644
--- a/app/views/news/_organization_show.html.erb
+++ b/app/views/news/_organization_show.html.erb
@@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
+ <%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
@@ -87,90 +72,7 @@
- <% unless @comments.empty? %>
-
-
回复(<%=@comments.count %>)
-
-
-
- <% @comments.each_with_index do |reply,i| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
-
-
- <%= reply.comments.html_safe%>
-
-
- <%= format_time(reply.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if @news.commentable? %>
-
-
-
-
- <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
-
-
-
-
- <%= l(:label_cancel_with_space) %>
-
-
-
- <% end %>
-
-
-
- <% end %>
+ <%= render :partial => 'news/news_all_replies' %>
@@ -97,90 +82,7 @@
- <% unless @comments.empty? %>
-
-
回复(<%=@comments.count %>)
-
-
-
- <% @comments.each_with_index do |reply,i| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
-
-
- <%= reply.comments.html_safe%>
-
-
- <%= format_time(reply.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if @news.commentable? %>
-
-
-
-
- <%= form_for @comment, :url=>{:controller => 'comments', :action => 'create', :id => @news}, :html => {:multipart => true, :id => 'add_comment_form'} do |f| %>
-
-
-
-
- <%= l(:label_cancel_with_space) %>
-
-
-
- <% end %>
-
-
-
- <% end %>
+ <%= render :partial => 'news/news_all_replies' %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
-
-
-
- <%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
- <%= time_from_now(comment.created_on) %>
-
- <% if !comment.parent.nil? && !comment.parent.parent.nil? %>
- <%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
- <% end %>
- <% if !comment.content_detail.blank? %>
-
-
-
-
-
-
- <%= link_to(
- l(:button_reply),
- {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage},
- :remote => true,
- :method => 'get',
- :title => l(:button_reply)) if !comment.root.locked? %>
-
-
- <% if comment.author == User.current %>
- <%= link_to(
- l(:button_delete),
- {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage},
- :method => :delete,
- :remote => true,
- :class => 'fr mr20',
- :data => {:confirm => l(:text_are_you_sure)},
- :title => l(:button_delete)) %>
- <% end %>
-
-
-
-
-
- <% end %>
-
-
-
- <% end %>
-
\ No newline at end of file
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb
index 783193e46..874a6b403 100644
--- a/app/views/users/_course_homework.html.erb
+++ b/app/views/users/_course_homework.html.erb
@@ -294,28 +294,12 @@
<% count=activity.journals_for_messages.count %>
-
-
回复
- ︿
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
-
-
-
- <%if count>3 %>
-
- <% end %>
-
+ <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity} %>
<% comments = activity.journals_for_messages.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
- <%=render :partial => 'users/homework_replies', :locals => {:comments => comments, :is_in_course => -1,:course_activity=>course_activity, :is_teacher => is_teacher, :user_activity_id => user_activity_id} %>
+ <%=render :partial => 'users/news_replies', :locals => {:comments => comments, :type => 'HomeworkCommon', :is_in_course => -1,:course_activity=>course_activity, :is_teacher => is_teacher, :user_activity_id => user_activity_id} %>
<% end %>
diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb
index c9fe344ba..3225a1a8b 100644
--- a/app/views/users/_course_journalsformessage.html.erb
+++ b/app/views/users/_course_journalsformessage.html.erb
@@ -40,16 +40,14 @@
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
- <%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
- <%# count = fetch_user_leaveWord_reply(activity).count %>
- <%= render :partial => 'users/journal_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
+ <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
- <%= render :partial => 'users/journal_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>
+ <%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>
<% end %>
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb
index 48daa6e95..0c16a4367 100644
--- a/app/views/users/_course_message.html.erb
+++ b/app/views/users/_course_message.html.erb
@@ -81,7 +81,7 @@
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
- <%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>
+ <%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb
index 18f16b068..f46282ff8 100644
--- a/app/views/users/_course_news.html.erb
+++ b/app/views/users/_course_news.html.erb
@@ -62,6 +62,7 @@
+
<% count=activity.comments.count %>
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
@@ -69,31 +70,32 @@
<% comments = activity.comments.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
- <%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
+ <%= render :partial => 'users/news_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'News', :activity_id => activity.id} %>
+
+ <% end %>
+ <% if activity.commentable? %>
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+ <% if User.current.logged? %>
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+ <% else %>
+ <%= render :partial => "users/show_unlogged" %>
+ <% end %>
+
+
+
<% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
-
- <% if User.current.logged? %>
-
- <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
- <% else %>
- <%= render :partial => "users/show_unlogged" %>
- <% end %>
-
-
-
-
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <%= link_to comment.user.show_name, user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <%= 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 %>
-
- <% end %>
-
-
-
-
-
-
- <%= link_to(
- l(:button_reply),
- {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => 'HomeworkCommon', :is_in_course => is_in_course, :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 => is_in_course, :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 %>
-
-
-
-
-
-
-
-
- <% end %>
-
\ No newline at end of file
diff --git a/app/views/users/_journal_reply_banner.html.erb b/app/views/users/_journal_reply_banner.html.erb
deleted file mode 100644
index 25175542f..000000000
--- a/app/views/users/_journal_reply_banner.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- 回复
- ︿
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
\ No newline at end of file
diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb
index c6f9d91b0..10a8e2b55 100644
--- a/app/views/users/_message_replies.html.erb
+++ b/app/views/users/_message_replies.html.erb
@@ -13,7 +13,7 @@
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
- <%= time_from_now(comment.created_on) %>
+ <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
@@ -28,6 +28,7 @@
+ <% if type == 'Message' %>
<%= link_to(
l(:button_reply),
@@ -37,7 +38,7 @@
:title => l(:button_reply)) %>
- <% if comment.course_destroyable_by?(User.current) %>
+ <% if comment.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_delete),
delete_board_message_path(comment,:board_id =>comment.board.id, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board),
@@ -48,6 +49,61 @@
:title => l(:button_delete)
) %>
<% end %>
+ <% elsif type == 'JournalsForMessage' %>
+
+ <%= link_to(
+ l(:button_reply),
+ {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
+ :remote => true,
+ :method => 'get',
+ :title => l(:button_reply)) %>
+
+
+ <% if comment.creator_user == User.current || User.current.admin? %>
+ <%= link_to('删除', {:controller => 'words', :action => 'destroy', :object_id => comment, :user_id => comment.user, :user_activity_id => user_activity_id, :activity_id => activity_id},
+ :remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20", :title => l(:button_delete)) %>
+ <% end %>
+ <% elsif type == 'OrgDocumentComment' %>
+
+ <%= link_to(
+ l(:button_reply),
+ {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id},
+ :remote => true,
+ :method => 'get',
+ :title => l(:button_reply)) %>
+
+
+ <% if comment.creator_user == User.current %>
+ <%= link_to(
+ l(:button_delete),
+ {:controller => 'org_document_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id},
+ :method => :delete,
+ :remote => true,
+ :class => 'fr mr20',
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:button_delete)) %>
+ <% end %>
+ <% elsif type == 'BlogComment' %>
+
+ <%= link_to(
+ l(:button_reply),
+ {:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :homepage => homepage},
+ :remote => true,
+ :method => 'get',
+ :title => l(:button_reply)) if !comment.root.locked? %>
+
+
+ <% if comment.author == User.current %>
+ <%= link_to(
+ l(:button_delete),
+ {:controller => 'blog_comments',:action => 'destroy', :id => comment.id, :user_activity_id => user_activity_id, :homepage => homepage},
+ :method => :delete,
+ :remote => true,
+ :class => 'fr mr20',
+ :data => {:confirm => l(:text_are_you_sure)},
+ :title => l(:button_delete)) %>
+ <% end %>
+ <% end %>
diff --git a/app/views/users/_message_reply_banner.html.erb b/app/views/users/_message_reply_banner.html.erb
deleted file mode 100644
index 0c8cda379..000000000
--- a/app/views/users/_message_reply_banner.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- 回复
- ︿
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
\ No newline at end of file
diff --git a/app/views/users/_journal_replies.html.erb b/app/views/users/_news_replies.html.erb
similarity index 58%
rename from app/views/users/_journal_replies.html.erb
rename to app/views/users/_news_replies.html.erb
index e6b9f6f7b..e6f28b653 100644
--- a/app/views/users/_journal_replies.html.erb
+++ b/app/views/users/_news_replies.html.erb
@@ -13,20 +13,20 @@
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
- <%= time_from_now(comment.created_on) %>
+ <%= time_from_now(comment.respond_to?(:created_on) ? comment.created_on : comment.created_at) %>
- <% if !comment.parent.nil? && !comment.parent.parent.nil? %>
+ <% if !comment.parent.nil? %>
<% parents_rely = [] %>
- <% parents_rely = get_reply_parents_no_root parents_rely, comment %>
+ <% parents_rely = get_reply_parents parents_rely, comment %>
<% length = parents_rely.length %>