diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb
index 92506d4e8..3759abf53 100644
--- a/app/controllers/at_controller.rb
+++ b/app/controllers/at_controller.rb
@@ -1,25 +1,143 @@
#coding=utf-8
class AtController < ApplicationController
- respond_to :js
+ respond_to :json
def show
- type = params[:type]
+ @logger = Logger.new(Rails.root.join('log', 'at.log').to_s)
+ users = find_at_users(params[:type], params[:id])
+ @users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }
+ end
+
+ private
+ def find_at_users(type, id)
+ @logger.info("#{type}, #{id}")
case type
when "Issue"
- @users = find_issue(params)
+ find_issue(id)
+ when 'Project'
+ find_project(id)
+ when 'Course'
+ find_course(id)
+ when 'Activity', 'CourseActivity', 'ForgeActivity','UserActivity', 'OrgActivity','PrincipalActivity'
+ find_activity(id, type)
+ when 'Attachment'
+ find_attachment(id)
+ when 'Message'
+ find_message(id)
else
+ nil
end
end
- private
- def find_issue(params)
+ def find_issue(id)
#1. issues list persons
#2. project persons
- issue = Issue.find(params[:id])
- journals = issue.journals
+ issue = Issue.find(id)
+ journals = issue.journals
at_persons = journals.map(&:user) + issue.project.users
- at_persons.uniq{|u| u.id}.delete_if{|u| u.id == User.current.id}
+ at_persons.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }
+ end
+
+ def find_project(id)
+ at_persons = Project.find(id).users
+ at_persons.delete_if { |u| u.id == User.current.id }
+ end
+
+ def find_course(id)
+ at_persons = Course.find(id).users
+ at_persons.delete_if { |u| u.id == User.current.id }
+ end
+
+ def find_activity(id, type)
+
+ ## 基本上是本类型中的 加上所属类型的用户
+ case type
+ when 'Activity'
+ activity = Activity.find(id)
+ (find_at_users(activity.act_type, activity.act_id) ||[]) +
+ (find_at_users(activity.activity_container_type, activity.activity_container_id) || [])
+ when 'CourseActivity'
+ activity = CourseActivity.find(id)
+ (find_at_users(activity.course_act_type, activity.course_act_id) || []) + (find_course(activity.course.id) || [])
+ when 'ForgeActivity'
+ activity = ForgeActivity.find(id)
+ (find_at_users(activity.forge_act_type, activity.forge_act_id) ||[]) +
+ (find_project(activity.project_id) || [])
+ when 'UserActivity'
+ activity = UserActivity.find(id)
+ (find_at_users(activity.act_type, activity.act_id) || []) +
+ (find_at_users(activity.container_type, activity.container_id) || [])
+ when 'OrgActivity'
+ activity = OrgActivity.find(id)
+ (find_at_users(activity.org_act_type, activity.org_act_id) || []) +
+ (find_at_users(activity.container_type, activity.container_id) || [])
+ when 'PrincipalActivity'
+ activity = PrincipalActivity.find(id)
+ find_at_users(activity.principal_act_type, activity.principal_act_id)
+ else
+ nil
+ end
+ end
+
+ #作业应该是关联课程,取课程的用户列表
+ def find_homework(id)
+ homework = HomeworkCommon.find(id)
+ find_course(homework.course_id)
+ end
+
+ def find_attachment(id)
+ attachment = Attachment.find(id)
+ find_at_users(attachment.container_type, attachment.container_id)
+ end
+
+ #Message
+ def find_message(id)
+ message = Message.find(id)
+ at_persons = message.board.messages.map(&:author)
+
+ end
+
+ #News
+ def find_news(id)
+ find_project(News.find(id).project_id)
+ end
+
+ #JournalsForMessage
+ def find_journals_for_message(id)
+ jounrnal = JournalsForMessage.find(id)
+ find_at_users(jounrnal.jour_type, jounrnal.jour_id)
+ end
+
+ #Poll
+ def find_poll(id)
+ end
+
+ #Journal
+ def find_journal(id)
+ journal = Journal.find(id)
+ find_at_users(journal.journalized_type, journal.journalized_id)
+ end
+
+ #Document
+ def find_document(id)
+ find_project(Document.find(id).project_id)
+ end
+
+ #ProjectCreateInfo
+ def find_project_create_info(id)
+
+ end
+
+ #Principal
+ def find_principal(id)
+
+ end
+
+ #BlogComment
+ def find_blog_comment(id)
+ blog = BlogComment.find(id).blog
+ blog.users
end
end
\ No newline at end of file
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 227de930f..98249dbc8 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1716,6 +1716,13 @@ module ApplicationHelper
#
def javascript_include_tag(*sources)
options = sources.last.is_a?(Hash) ? sources.pop : {}
+
+ @sources ||= []
+ sources = sources.delete_if do|source|
+ @sources.include?(source)
+ end
+ @sources += sources
+
if plugin = options.delete(:plugin)
sources = sources.map do |source|
if plugin
@@ -1725,7 +1732,12 @@ module ApplicationHelper
end
end
end
- super sources, options
+
+ if sources && !sources.empty?
+ super(sources, options)
+ else
+ ''
+ end
end
def content_for(name, content = nil, &block)
@@ -2621,11 +2633,8 @@ int main(int argc, char** argv){
end
def import_ke(default_opt={})
- opt = {enable_at: true, prettify: false, init_activity: false}.merge default_opt
+ opt = {enable_at: false, prettify: false, init_activity: false}.merge default_opt
ss = ''
- if opt[:enable_at]
- ss += %Q||
- end
ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg')
if opt[:enable_at]
diff --git a/app/views/at/show.js.erb b/app/views/at/show.js.erb
deleted file mode 100644
index df253f237..000000000
--- a/app/views/at/show.js.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-(function(){
- window.atPersonLists = [];
- <% @users && @users.each_with_index do |person,index| %>
- var o = {id: <%=index%>, name: '<%=person.show_name%>', login: '<%=person.login%>', searchKey: '<%=person.get_at_show_name%>'};
- atPersonLists.push(o);
- <% end %>
-
-})();
diff --git a/app/views/at/show.json.erb b/app/views/at/show.json.erb
new file mode 100644
index 000000000..7af729ff7
--- /dev/null
+++ b/app/views/at/show.json.erb
@@ -0,0 +1,6 @@
+[
+ <% @users && @users.each_with_index do |person,index| %>
+ {"id": <%=index%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
+ <%= index != @users.size-1 ? ',' : '' %>
+ <% end %>
+]
diff --git a/app/views/bids/_new_homework_form.html.erb b/app/views/bids/_new_homework_form.html.erb
index 5958fccff..815ff27e4 100644
--- a/app/views/bids/_new_homework_form.html.erb
+++ b/app/views/bids/_new_homework_form.html.erb
@@ -15,10 +15,10 @@
<% if edit_mode %>
- <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0 %>
+ <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0,act_id: @course.id, act_type: @course.class.to_s %>
<% else %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
- <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0 %>
+ <%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0, act_id: @course.id, act_type: @course.class.to_s %>
<% end %>
diff --git a/app/views/blog_comments/_edit.html.erb b/app/views/blog_comments/_edit.html.erb
index c7065ece4..048402635 100644
--- a/app/views/blog_comments/_edit.html.erb
+++ b/app/views/blog_comments/_edit.html.erb
@@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false) %>
+ <%= import_ke(enable_at: true, prettify: false) %>
<%= javascript_include_tag 'blog' %>
<% end %>
@@ -34,7 +34,9 @@
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
- :maxlength => 5000 }%>
+ :maxlength => 5000 },
+ act_id: article.id, act_type: article.class.to_s
+ %>
diff --git a/app/views/blog_comments/_reply_form.html.erb b/app/views/blog_comments/_reply_form.html.erb
index 32f4333c2..67642069c 100644
--- a/app/views/blog_comments/_reply_form.html.erb
+++ b/app/views/blog_comments/_reply_form.html.erb
@@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false) %>
+ <%= import_ke(enable_at: true, prettify: false) %>
<% end %>
@@ -27,7 +27,9 @@
:minHeight=>100,
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
- :maxlength => 5000 }%>
+ :maxlength => 5000 },
+ at_id: article.id, at_type: article.class.to_s
+ %>
diff --git a/app/views/blog_comments/quote.js.erb b/app/views/blog_comments/quote.js.erb
index 088b2cf67..cd53707d5 100644
--- a/app/views/blog_comments/quote.js.erb
+++ b/app/views/blog_comments/quote.js.erb
@@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
- init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%");
+ init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>");
});
}else if($("#reply_to_message_<%= @blogComment.id%>").length >0) {
$("#reply_to_message_<%= @blogComment.id%>").replaceWith("");
diff --git a/app/views/blog_comments/reply.js.erb b/app/views/blog_comments/reply.js.erb
index 1cb64b2b5..06adca74d 100644
--- a/app/views/blog_comments/reply.js.erb
+++ b/app/views/blog_comments/reply.js.erb
@@ -1,7 +1,7 @@
<% if @in_user_center%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
- init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
+ init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
<% else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
+init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
<% end %>
\ No newline at end of file
diff --git a/app/views/blog_comments/show.html.erb b/app/views/blog_comments/show.html.erb
index e46a7249f..aa984c621 100644
--- a/app/views/blog_comments/show.html.erb
+++ b/app/views/blog_comments/show.html.erb
@@ -27,7 +27,7 @@
}
}
$(function() {
- init_activity_KindEditor_data(<%= @article.id%>,null,"85%");
+ init_activity_KindEditor_data(<%= @article.id%>,null,"85%", '<%=@article.class.to_s%>');
showNormalImage('message_description_<%= @article.id %>');
});
diff --git a/app/views/blogs/_article_list.html.erb b/app/views/blogs/_article_list.html.erb
index a91dd8151..f6383c95b 100644
--- a/app/views/blogs/_article_list.html.erb
+++ b/app/views/blogs/_article_list.html.erb
@@ -74,7 +74,7 @@
}
$(function () {
- init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
+ init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) {
diff --git a/app/views/boards/_course_new.html.erb b/app/views/boards/_course_new.html.erb
index e4cf57ae3..31cdf41eb 100644
--- a/app/views/boards/_course_new.html.erb
+++ b/app/views/boards/_course_new.html.erb
@@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false) %>
+ <%= import_ke(enable_at: true, prettify: false) %>
<% end %>
<%= error_messages_for 'message' %>
@@ -34,7 +34,9 @@
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
- :maxlength => 5000 }%>
+ :maxlength => 5000 },
+ at_id: topic.id, at_type: topic.class.to_s
+ %>
diff --git a/app/views/boards/_course_show.html.erb b/app/views/boards/_course_show.html.erb
index 306a0c7ce..074da9af1 100644
--- a/app/views/boards/_course_show.html.erb
+++ b/app/views/boards/_course_show.html.erb
@@ -74,7 +74,7 @@
}
$(function () {
- init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
+ init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) {
diff --git a/app/views/comments/create.js.erb b/app/views/comments/create.js.erb
index ea904a63f..c3942ee38 100644
--- a/app/views/comments/create.js.erb
+++ b/app/views/comments/create.js.erb
@@ -1,3 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
-init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%");
+init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%", "UserActivity");
diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb
index b4c560fa4..d31b28bc0 100644
--- a/app/views/courses/_course_activity.html.erb
+++ b/app/views/courses/_course_activity.html.erb
@@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
-
diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb
index f4b8ce8a4..9d20b5adb 100644
--- a/app/views/courses/syllabus.html.erb
+++ b/app/views/courses/syllabus.html.erb
@@ -1,6 +1,6 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<%= javascript_include_tag 'blog' %>
<% end %>
@@ -40,7 +40,7 @@
}
}
$(function() {
- init_activity_KindEditor_data(<%= @article.id%>,null,"87%");
+ init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>");
showNormalImage('message_description_<%= @article.id %>');
});
diff --git a/app/views/homework_common/start_anonymous_comment.js.erb b/app/views/homework_common/start_anonymous_comment.js.erb
index ea63ea12c..ffeda2cb5 100644
--- a/app/views/homework_common/start_anonymous_comment.js.erb
+++ b/app/views/homework_common/start_anonymous_comment.js.erb
@@ -2,10 +2,10 @@
alert('启动成功');
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
- init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
+ init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
- init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
+ init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
<% end %>
/*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/
<% elsif @statue == 2 %>
diff --git a/app/views/homework_common/stop_anonymous_comment.js.erb b/app/views/homework_common/stop_anonymous_comment.js.erb
index 214a157dc..308e8a39f 100644
--- a/app/views/homework_common/stop_anonymous_comment.js.erb
+++ b/app/views/homework_common/stop_anonymous_comment.js.erb
@@ -1,10 +1,10 @@
alert('关闭成功');
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
-init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
+init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
+init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
<% end %>
/*
$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/
diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb
index b8f362429..05793ea7c 100644
--- a/app/views/issues/_edit.html.erb
+++ b/app/views/issues/_edit.html.erb
@@ -1,8 +1,7 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<% end %>
-
<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %>
<%= error_messages_for 'issue', 'time_entry' %>
<%= render :partial => 'conflict' if @conflict %>
@@ -24,7 +23,7 @@
diff --git a/app/views/issues/_form.html.erb b/app/views/issues/_form.html.erb
index 0d5c876f1..c1d2a841b 100644
--- a/app/views/issues/_form.html.erb
+++ b/app/views/issues/_form.html.erb
@@ -49,7 +49,7 @@
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
- <%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true %>
+ <%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true,at_id: @project.id, at_type: @project.class.to_s %>
<%# end %>
<%#= wikitoolbar_for 'issue_description' %>
<% end %>
diff --git a/app/views/issues/add_journal.js.erb b/app/views/issues/add_journal.js.erb
index 0b1c02b88..8ff5a71f1 100644
--- a/app/views/issues/add_journal.js.erb
+++ b/app/views/issues/add_journal.js.erb
@@ -1,3 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
\ No newline at end of file
+init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
\ No newline at end of file
diff --git a/app/views/issues/add_journal_in_org.js.erb b/app/views/issues/add_journal_in_org.js.erb
index ad7a85540..34e874f13 100644
--- a/app/views/issues/add_journal_in_org.js.erb
+++ b/app/views/issues/add_journal_in_org.js.erb
@@ -1,3 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
\ No newline at end of file
+init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
\ No newline at end of file
diff --git a/app/views/issues/new.html.erb b/app/views/issues/new.html.erb
index 9c6ad647c..c4daedaa4 100644
--- a/app/views/issues/new.html.erb
+++ b/app/views/issues/new.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: true, prettify: false, init_activity: false) %>
<% end %>
diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb
index 67d1186c4..80d3aaac1 100644
--- a/app/views/issues/show.html.erb
+++ b/app/views/issues/show.html.erb
@@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
-<%= import_ke(enable_at: {id: @issue.id, type: 'Issue'}) %>
+<%= import_ke(enable_at: true) %>
<% end %>
diff --git a/app/views/memos/show.html.erb b/app/views/memos/show.html.erb
index 44f3e5a64..b7cc1a0c2 100644
--- a/app/views/memos/show.html.erb
+++ b/app/views/memos/show.html.erb
@@ -34,7 +34,7 @@
}
}
$(function() {
- init_activity_KindEditor_data(<%= @memo.id%>,null,"87%");
+ init_activity_KindEditor_data(<%= @memo.id%>,null,"87%", "<%=@memo.class.to_s%>");
});
function del_confirm(){
diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb
index 0f39b73d2..e06c04775 100644
--- a/app/views/messages/_course_show.html.erb
+++ b/app/views/messages/_course_show.html.erb
@@ -27,7 +27,7 @@
}
}
$(function() {
- init_activity_KindEditor_data(<%= @topic.id%>,null,"85%");
+ init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>");
showNormalImage('message_description_<%= @topic.id %>');
});
diff --git a/app/views/messages/quote.js.erb b/app/views/messages/quote.js.erb
index eee820c61..b0e8ecb85 100644
--- a/app/views/messages/quote.js.erb
+++ b/app/views/messages/quote.js.erb
@@ -11,7 +11,7 @@ if($("#reply_message_<%= @message.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
- init_activity_KindEditor_data(<%= @message.id%>,null,"85%");
+ init_activity_KindEditor_data(<%= @message.id%>,null,"85%", "<%=@message.class.to_s%>");
});
}else if($("#reply_to_message_<%= @message.id%>").length >0) {
$("#reply_to_message_<%= @message.id%>").replaceWith("
");
diff --git a/app/views/messages/reply.js.erb b/app/views/messages/reply.js.erb
index ac80de3b4..518479344 100644
--- a/app/views/messages/reply.js.erb
+++ b/app/views/messages/reply.js.erb
@@ -3,4 +3,4 @@
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
\ No newline at end of file
+init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
\ No newline at end of file
diff --git a/app/views/org_document_comments/_reply_form.html.erb b/app/views/org_document_comments/_reply_form.html.erb
index 7871b910d..8808ff8b7 100644
--- a/app/views/org_document_comments/_reply_form.html.erb
+++ b/app/views/org_document_comments/_reply_form.html.erb
@@ -1,2 +1,2 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
+init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
diff --git a/app/views/org_document_comments/add_reply.js.erb b/app/views/org_document_comments/add_reply.js.erb
index 40ed2eeb2..84f8c1f83 100644
--- a/app/views/org_document_comments/add_reply.js.erb
+++ b/app/views/org_document_comments/add_reply.js.erb
@@ -1,3 +1,3 @@
$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document, :act => @act}) %>");
-init_activity_KindEditor_data(<%= @act.id %>,"","87%");
\ No newline at end of file
+init_activity_KindEditor_data(<%= @act.id %>,"","87%", "<%=@act.class.to_s%>");
\ No newline at end of file
diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb
index 331e61bfd..ddbb6bf9c 100644
--- a/app/views/org_document_comments/index.html.erb
+++ b/app/views/org_document_comments/index.html.erb
@@ -19,7 +19,7 @@
<% @documents.each do |document| %>
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first} %>
diff --git a/app/views/org_document_comments/quote.js.erb b/app/views/org_document_comments/quote.js.erb
index a71b23f0e..7ea5daf7b 100644
--- a/app/views/org_document_comments/quote.js.erb
+++ b/app/views/org_document_comments/quote.js.erb
@@ -3,7 +3,7 @@ if($("#reply_message_<%= @org_comment.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
- init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%");
+ init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%", "<%=@org_comment.class.to_s%>");
});
}else if($("#reply_to_message_<%= @org_comment.id %>").length >0) {
$("#reply_to_message_<%= @org_comment.id%>").replaceWith("");
diff --git a/app/views/org_document_comments/show.html.erb b/app/views/org_document_comments/show.html.erb
index 1b1eca418..3a50e5faa 100644
--- a/app/views/org_document_comments/show.html.erb
+++ b/app/views/org_document_comments/show.html.erb
@@ -5,7 +5,7 @@
diff --git a/app/views/organizations/_org_activities.html.erb b/app/views/organizations/_org_activities.html.erb
index 33ac13e76..8f9acbc7b 100644
--- a/app/views/organizations/_org_activities.html.erb
+++ b/app/views/organizations/_org_activities.html.erb
@@ -2,7 +2,7 @@
<% org_activities.each do |act| %>
<% if act.container_type == 'Organization' %>
diff --git a/app/views/organizations/show.html.erb b/app/views/organizations/show.html.erb
index 7200761a3..9d62dd1f9 100644
--- a/app/views/organizations/show.html.erb
+++ b/app/views/organizations/show.html.erb
@@ -59,7 +59,7 @@
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 %>
<% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %>
diff --git a/app/views/student_work/forbidden_anonymous_comment.js.erb b/app/views/student_work/forbidden_anonymous_comment.js.erb
index a72c29509..47dfb4b51 100644
--- a/app/views/student_work/forbidden_anonymous_comment.js.erb
+++ b/app/views/student_work/forbidden_anonymous_comment.js.erb
@@ -1,7 +1,7 @@
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
-init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
+init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
-init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
+init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
<% end %>
\ No newline at end of file
diff --git a/app/views/student_work/set_score_rule.js.erb b/app/views/student_work/set_score_rule.js.erb
index ff3a0e7ed..180f04faa 100644
--- a/app/views/student_work/set_score_rule.js.erb
+++ b/app/views/student_work/set_score_rule.js.erb
@@ -1,8 +1,8 @@
clickCanel();
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id}) %>");
- init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
+ init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
<% else %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
- init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
+ init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_activities.html.erb b/app/views/users/_user_activities.html.erb
index 4f1d3a5d8..557b9e9ee 100644
--- a/app/views/users/_user_activities.html.erb
+++ b/app/views/users/_user_activities.html.erb
@@ -1,12 +1,12 @@
<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
+ <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>