From 3476731b83a418fa31153866e64245a6ecb16554 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Wed, 9 Dec 2015 09:59:13 +0800
Subject: [PATCH 01/12] =?UTF-8?q?=E5=B0=86at=20js=20data=E6=95=B4=E5=90=88?=
=?UTF-8?q?=E5=88=B0=E6=96=87=E4=BB=B6=E4=B8=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/at_controller.rb | 25 +++++++++++++++++++++++
app/controllers/issues_controller.rb | 29 ++++++++++-----------------
app/helpers/application_helper.rb | 10 +--------
app/views/at/show.js.erb | 8 ++++++++
app/views/issues/show.html.erb | 2 +-
config/routes.rb | 3 ++-
public/assets/kindeditor/at/config.js | 5 ++---
7 files changed, 50 insertions(+), 32 deletions(-)
create mode 100644 app/controllers/at_controller.rb
create mode 100644 app/views/at/show.js.erb
diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb
new file mode 100644
index 000000000..92506d4e8
--- /dev/null
+++ b/app/controllers/at_controller.rb
@@ -0,0 +1,25 @@
+#coding=utf-8
+
+class AtController < ApplicationController
+ respond_to :js
+
+ def show
+ type = params[:type]
+ case type
+ when "Issue"
+ @users = find_issue(params)
+ else
+ end
+ end
+
+ private
+ def find_issue(params)
+ #1. issues list persons
+ #2. project persons
+ issue = Issue.find(params[: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}
+ end
+
+end
\ No newline at end of file
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 7cdc838e2..6f441c29a 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -142,24 +142,17 @@ class IssuesController < ApplicationController
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
- #id name email
- #1. issues list persons
- #2. project persons
- @at_persons = @journals.map(&:user) + @issue.project.users
- @at_persons = @at_persons.uniq{|u| u.id}.delete_if{|u| u.id == User.current.id}
- @at_persons = nil
-
- respond_to do |format|``
- format.html {
- retrieve_previous_and_next_issue_ids
- render :template => 'issues/show', :layout => @project_base_tag#by young
- }
- format.api
- format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
- format.pdf {
- pdf = issue_to_pdf(@issue, :journals => @journals)
- send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") )
- }
+ respond_to do |format|
+ format.html {
+ retrieve_previous_and_next_issue_ids
+ render :template => 'issues/show', :layout => @project_base_tag#by young
+ }
+ format.api
+ format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
+ format.pdf {
+ pdf = issue_to_pdf(@issue, :journals => @journals)
+ send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") )
+ }
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ba8fe4f53..227de930f 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2624,15 +2624,7 @@ int main(int argc, char** argv){
opt = {enable_at: true, prettify: false, init_activity: false}.merge default_opt
ss = ''
if opt[:enable_at]
- ss = '"
+ ss += %Q||
end
ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg')
diff --git a/app/views/at/show.js.erb b/app/views/at/show.js.erb
new file mode 100644
index 000000000..df253f237
--- /dev/null
+++ b/app/views/at/show.js.erb
@@ -0,0 +1,8 @@
+(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/issues/show.html.erb b/app/views/issues/show.html.erb
index 80d3aaac1..67d1186c4 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: true) %>
+<%= import_ke(enable_at: {id: @issue.id, type: 'Issue'}) %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 59eb29d70..656f55720 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1035,13 +1035,14 @@ RedmineApp::Application.routes.draw do
match 'system_log/clear'
##ended by lizanle
-
resources :git_callback do
collection do
post 'post_update'
end
end
+ resources :at
+
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb")
if File.exists?(file)
diff --git a/public/assets/kindeditor/at/config.js b/public/assets/kindeditor/at/config.js
index b9769c42e..0a1bbf11a 100644
--- a/public/assets/kindeditor/at/config.js
+++ b/public/assets/kindeditor/at/config.js
@@ -1,4 +1,4 @@
-function enableAt(_editor) {
+var enableAt = function(_editor) {
var editor = _editor;
if(editor.edit == undefined || editor.edit.iframe == undefined){
return;
@@ -11,7 +11,7 @@ function enableAt(_editor) {
console.log("enable at");
$.fn.atwho.debug = true;
- if(!atPersonLists){
+ if("undefined" === (typeof atPersonLists) || !atPersonLists){
return;
}
var names = atPersonLists;
@@ -32,7 +32,6 @@ function enableAt(_editor) {
}
$inputor = $(ifrBody).atwho(at_config);
- window.aaa= $inputor;
$inputor.caret('pos', 47);
$inputor.focus().atwho('run');
};
From 91b245ad2cb694726996c31811276b5129a0be7e Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Sat, 12 Dec 2015 18:06:59 +0800
Subject: [PATCH 02/12] =?UTF-8?q?lastname=E4=B8=BA=E7=A9=BA=E6=97=B6?=
=?UTF-8?q?=E4=B9=9F=E5=8F=AF=E4=BB=A5=E5=8A=A0,=E5=8F=AF=E4=BB=A5?=
=?UTF-8?q?=E7=9C=81=E6=8E=89=E6=9F=A5=E8=AF=A2extensions=E7=9A=84?=
=?UTF-8?q?=E8=AF=AD=E5=8F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/user.rb | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/app/models/user.rb b/app/models/user.rb
index 65c0bf858..0d3d465e2 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -399,16 +399,7 @@ class User < Principal
end
def show_name
- name = ""
- unless self.user_extensions.nil?
- if self.user_extensions.identity == 2
- name = firstname
- else
- name = lastname+firstname
- end
- else
- name = lastname+firstname
- end
+ name = lastname + firstname
name.empty? || name.nil? ? login : name
end
## end
From f61f639af2fe13598a74d1e35507470b15d735e1 Mon Sep 17 00:00:00 2001
From: guange <8863824@gmail.com>
Date: Mon, 14 Dec 2015 17:13:57 +0800
Subject: [PATCH 03/12] =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E4=B8=BAremote=20js?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/at_controller.rb | 140 ++++++++++++++++--
app/helpers/application_helper.rb | 19 ++-
app/views/at/show.js.erb | 8 -
app/views/at/show.json.erb | 6 +
app/views/bids/_new_homework_form.html.erb | 4 +-
app/views/blog_comments/_edit.html.erb | 6 +-
app/views/blog_comments/_reply_form.html.erb | 6 +-
app/views/blog_comments/quote.js.erb | 2 +-
app/views/blog_comments/reply.js.erb | 4 +-
app/views/blog_comments/show.html.erb | 2 +-
app/views/blogs/_article_list.html.erb | 2 +-
app/views/boards/_course_new.html.erb | 6 +-
app/views/boards/_course_show.html.erb | 2 +-
app/views/comments/create.js.erb | 2 +-
app/views/courses/_course_activity.html.erb | 6 +-
app/views/courses/_courses_jours.html.erb | 5 +-
app/views/courses/syllabus.html.erb | 4 +-
.../start_anonymous_comment.js.erb | 4 +-
.../stop_anonymous_comment.js.erb | 4 +-
app/views/issues/_edit.html.erb | 5 +-
app/views/issues/_form.html.erb | 2 +-
app/views/issues/add_journal.js.erb | 2 +-
app/views/issues/add_journal_in_org.js.erb | 2 +-
app/views/issues/new.html.erb | 2 +-
app/views/issues/show.html.erb | 2 +-
app/views/memos/show.html.erb | 2 +-
app/views/messages/_course_show.html.erb | 2 +-
app/views/messages/quote.js.erb | 2 +-
app/views/messages/reply.js.erb | 2 +-
.../_reply_form.html.erb | 2 +-
.../org_document_comments/add_reply.js.erb | 2 +-
.../org_document_comments/index.html.erb | 2 +-
app/views/org_document_comments/quote.js.erb | 2 +-
app/views/org_document_comments/show.html.erb | 2 +-
.../organizations/_org_activities.html.erb | 2 +-
app/views/organizations/show.html.erb | 2 +-
.../forbidden_anonymous_comment.js.erb | 4 +-
app/views/student_work/set_score_rule.js.erb | 4 +-
app/views/users/_user_activities.html.erb | 6 +-
app/views/users/_user_homework_form.html.erb | 6 +-
app/views/users/_user_homework_list.html.erb | 6 +-
app/views/words/create_reply.js.erb | 2 +-
app/views/words/leave_homework_message.js.erb | 4 +-
.../lib/rails_kindeditor/helper.rb | 13 +-
public/assets/kindeditor/at/config.js | 17 ++-
.../javascripts/init_activity_KindEditor.js | 9 +-
46 files changed, 245 insertions(+), 95 deletions(-)
delete mode 100644 app/views/at/show.js.erb
create mode 100644 app/views/at/show.json.erb
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]
- case type
- when "Issue"
- @users = find_issue(params)
- else
- end
+ @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_issue(params)
+ def find_at_users(type, id)
+ @logger.info("#{type}, #{id}")
+ case type
+ when "Issue"
+ 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
+
+ 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 %>