Merge branch 'cxt_replies' into weixin_guange
This commit is contained in:
commit
5ac30fe09c
|
@ -145,10 +145,12 @@ class BlogCommentsController < ApplicationController
|
||||||
@blogComment.content = params[:blog_comment][:content]
|
@blogComment.content = params[:blog_comment][:content]
|
||||||
parent = BlogComment.find params[:parent_id]
|
parent = BlogComment.find params[:parent_id]
|
||||||
@blogComment.reply_id = params[:id]
|
@blogComment.reply_id = params[:id]
|
||||||
|
@blogComment.root_id = parent.root_id.nil? ? parent.id : parent.root_id
|
||||||
parent.children << @blogComment
|
parent.children << @blogComment
|
||||||
else
|
else
|
||||||
@quote = params[:quote][:quote] || ""
|
@quote = params[:quote][:quote] || ""
|
||||||
@blogComment.content = @quote + @blogComment.content
|
@blogComment.content = @quote + @blogComment.content
|
||||||
|
@blogComment.root_id = @article.id
|
||||||
@article.children << @blogComment
|
@article.children << @blogComment
|
||||||
end
|
end
|
||||||
@article.save
|
@article.save
|
||||||
|
|
|
@ -126,7 +126,8 @@ class BoardsController < ApplicationController
|
||||||
@type = 2
|
@type = 2
|
||||||
@topics.each do |topic|
|
@topics.each do |topic|
|
||||||
all_comments = []
|
all_comments = []
|
||||||
count=get_all_children(all_comments, topic).count
|
#count=get_all_children(all_comments, topic).count
|
||||||
|
count=Message.where("root_id = #{topic.id}").count
|
||||||
topic[:infocount] = get_praise_num(topic) + count
|
topic[:infocount] = get_praise_num(topic) + count
|
||||||
if topic[:infocount] < 0
|
if topic[:infocount] < 0
|
||||||
topic[:infocount] = 0
|
topic[:infocount] = 0
|
||||||
|
|
|
@ -26,7 +26,7 @@ class FilesController < ApplicationController
|
||||||
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
|
before_filter :authorize, :except => [:create,:getattachtype,:quote_resource_show,:search,:searchone4reload,:search_project,:quote_resource_show_project,
|
||||||
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
|
:search_tag_attachment,:subfield_upload_file,:search_org_subfield_tag_attachment,
|
||||||
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
|
:search_tag_attachment,:quote_resource_show_org_subfield,:find_org_subfield_attache,
|
||||||
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description]
|
:search_files_in_subfield,:upload_files_menu,:file_hidden,:republish_file,:update_file_description, :edit_file_description]
|
||||||
|
|
||||||
helper :sort
|
helper :sort
|
||||||
include SortHelper
|
include SortHelper
|
||||||
|
@ -981,6 +981,13 @@ class FilesController < ApplicationController
|
||||||
def upload_files_menu
|
def upload_files_menu
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def edit_file_description
|
||||||
|
@attachment = Attachment.find(params[:id])
|
||||||
|
@attachment.description = params[:file_description_edit]
|
||||||
|
@attachment.save
|
||||||
|
end
|
||||||
|
|
||||||
def update_file_description
|
def update_file_description
|
||||||
@attachment = Attachment.find(params[:id])
|
@attachment = Attachment.find(params[:id])
|
||||||
@attachment.description = params[:description]
|
@attachment.description = params[:description]
|
||||||
|
|
|
@ -45,7 +45,7 @@ class MessagesController < ApplicationController
|
||||||
# page = 1 + offset / REPLIES_PER_PAGE
|
# page = 1 + offset / REPLIES_PER_PAGE
|
||||||
# end
|
# end
|
||||||
all_comments = []
|
all_comments = []
|
||||||
@replies = get_all_children(all_comments, @topic)
|
@replies = Message.where("root_id = #{@topic.id}").reorder("created_on desc")
|
||||||
@reply_count = @replies.count
|
@reply_count = @replies.count
|
||||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||||
@limit = 10
|
@limit = 10
|
||||||
|
@ -165,6 +165,7 @@ class MessagesController < ApplicationController
|
||||||
@reply.content = params[:content]
|
@reply.content = params[:content]
|
||||||
@reply.subject = "RE: #{@topic.subject}"
|
@reply.subject = "RE: #{@topic.subject}"
|
||||||
@reply.reply_id = params[:id]
|
@reply.reply_id = params[:id]
|
||||||
|
@reply.root_id = parent.root_id.nil? ? parent.id : parent.root_id
|
||||||
# @reply.reply_id = params[:id]
|
# @reply.reply_id = params[:id]
|
||||||
parent.children << @reply
|
parent.children << @reply
|
||||||
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
|
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
|
||||||
|
@ -178,6 +179,7 @@ class MessagesController < ApplicationController
|
||||||
@reply.safe_attributes = params[:reply]
|
@reply.safe_attributes = params[:reply]
|
||||||
@reply.content = @quote + @reply.content
|
@reply.content = @quote + @reply.content
|
||||||
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
|
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
|
||||||
|
@reply.root_id = @topic.id
|
||||||
@topic.children << @reply
|
@topic.children << @reply
|
||||||
# @reply.reply_id = params[:id]
|
# @reply.reply_id = params[:id]
|
||||||
end
|
end
|
||||||
|
|
|
@ -89,6 +89,7 @@ class OrgDocumentCommentsController < ApplicationController
|
||||||
@act = OrgActivity.find(params[:act_id])
|
@act = OrgActivity.find(params[:act_id])
|
||||||
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
|
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
|
||||||
@comment.content = params[:org_content]
|
@comment.content = params[:org_content]
|
||||||
|
@comment.root_id = @document.id
|
||||||
@document.children << @comment
|
@document.children << @comment
|
||||||
@document.save
|
@document.save
|
||||||
end
|
end
|
||||||
|
@ -102,6 +103,7 @@ class OrgDocumentCommentsController < ApplicationController
|
||||||
@comment.content = params[:org_comment][:org_content]
|
@comment.content = params[:org_comment][:org_content]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@comment.root_id = @document.id
|
||||||
@document.children << @comment
|
@document.children << @comment
|
||||||
@document.save
|
@document.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -161,6 +163,7 @@ class OrgDocumentCommentsController < ApplicationController
|
||||||
|
|
||||||
@org_document.title = params[:org_document_comment][:title]
|
@org_document.title = params[:org_document_comment][:title]
|
||||||
@org_document.content = params[:org_document_comment][:content]
|
@org_document.content = params[:org_document_comment][:content]
|
||||||
|
@org_document.root_id = @document.root_id.nil? ? @document.id : @document.root_id
|
||||||
|
|
||||||
@document.children << @org_document
|
@document.children << @org_document
|
||||||
@document = @document.root
|
@document = @document.root
|
||||||
|
|
|
@ -3524,19 +3524,19 @@ class UsersController < ApplicationController
|
||||||
if params[:type].present?
|
if params[:type].present?
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when 'OrgDocumentComment'
|
when 'OrgDocumentComment'
|
||||||
obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
|
#obj = OrgDocumentComment.where('id = ?', params[:id].to_i).first
|
||||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||||
@type = 'OrgDocumentComment'
|
@type = 'OrgDocumentComment'
|
||||||
comments = []
|
#comments = []
|
||||||
@journals = get_all_children(comments, obj)
|
@journals = OrgDocumentComment.where("root_id = #{params[:id].to_i}").reorder("created_at desc")
|
||||||
when 'Message'
|
when 'Message'
|
||||||
obj = Message.where('id = ?', params[:id].to_i).first
|
#obj = Message.where('id = ?', params[:id].to_i).first
|
||||||
@type = 'Message'
|
@type = 'Message'
|
||||||
@is_course = params[:is_course]
|
@is_course = params[:is_course]
|
||||||
@is_board = params[:is_board]
|
@is_board = params[:is_board]
|
||||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||||
comments = []
|
#comments = []
|
||||||
@journals = get_all_children(comments, obj)
|
@journals = Message.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
|
||||||
when 'News'
|
when 'News'
|
||||||
obj = News.where('id = ?', params[:id].to_i).first
|
obj = News.where('id = ?', params[:id].to_i).first
|
||||||
@journals = obj.comments.reorder("created_on desc")
|
@journals = obj.comments.reorder("created_on desc")
|
||||||
|
@ -3548,9 +3548,9 @@ class UsersController < ApplicationController
|
||||||
@type = 'Syllabus'
|
@type = 'Syllabus'
|
||||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||||
when 'JournalsForMessage'
|
when 'JournalsForMessage'
|
||||||
obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
|
#obj = JournalsForMessage.where('id = ?', params[:id].to_i).first
|
||||||
journals = []
|
#journals = []
|
||||||
@journals = get_all_children(journals, obj)
|
@journals = JournalsForMessage.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
|
||||||
@type = 'JournalsForMessage'
|
@type = 'JournalsForMessage'
|
||||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||||
when 'Issue'
|
when 'Issue'
|
||||||
|
@ -3559,13 +3559,13 @@ class UsersController < ApplicationController
|
||||||
@type = 'Issue'
|
@type = 'Issue'
|
||||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||||
when 'BlogComment'
|
when 'BlogComment'
|
||||||
obj = BlogComment.where('id = ?', params[:id].to_i).first
|
#obj = BlogComment.where('id = ?', params[:id].to_i).first
|
||||||
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
@user_activity_id = params[:div_id].to_i if params[:div_id]
|
||||||
@homepage = params[:homepage].to_i
|
@homepage = params[:homepage].to_i
|
||||||
@type = 'BlogComment'
|
@type = 'BlogComment'
|
||||||
@user_id = obj.author_id
|
@user_id = obj.author_id
|
||||||
comments = []
|
#comments = []
|
||||||
@journals = get_all_children(comments, obj)
|
@journals = BlogComment.where("root_id = #{params[:id].to_i}").reorder("created_on desc")
|
||||||
when 'HomeworkCommon'
|
when 'HomeworkCommon'
|
||||||
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
|
obj = HomeworkCommon.where('id = ?', params[:id].to_i).first
|
||||||
@type = 'HomeworkCommon'
|
@type = 'HomeworkCommon'
|
||||||
|
|
|
@ -41,6 +41,7 @@ class WordsController < ApplicationController
|
||||||
# 删除留言功能要调用destroy,也记得在destroy.js中修改
|
# 删除留言功能要调用destroy,也记得在destroy.js中修改
|
||||||
|
|
||||||
# deny api. api useless
|
# deny api. api useless
|
||||||
|
parent = JournalsForMessage.find params[:reference_id].to_i
|
||||||
parent_id = params[:reference_id]
|
parent_id = params[:reference_id]
|
||||||
author_id = User.current.id
|
author_id = User.current.id
|
||||||
reply_user_id = params[:reference_user_id]
|
reply_user_id = params[:reference_user_id]
|
||||||
|
@ -52,7 +53,8 @@ class WordsController < ApplicationController
|
||||||
:m_parent_id => parent_id,
|
:m_parent_id => parent_id,
|
||||||
:m_reply_id => reply_id,
|
:m_reply_id => reply_id,
|
||||||
:reply_id => reply_user_id,
|
:reply_id => reply_user_id,
|
||||||
:notes => content,
|
:notes => content,
|
||||||
|
:root_id => parent.root_id.nil? ? parent.id : parent.root_id,
|
||||||
:is_readed => false}
|
:is_readed => false}
|
||||||
@activity = params[:activity_id].nil? ? JournalsForMessage.find(parent_id) : JournalsForMessage.find(params[:activity_id].to_i)
|
@activity = params[:activity_id].nil? ? JournalsForMessage.find(parent_id) : JournalsForMessage.find(params[:activity_id].to_i)
|
||||||
@jfm = add_reply_adapter(@activity, options)
|
@jfm = add_reply_adapter(@activity, options)
|
||||||
|
@ -274,7 +276,7 @@ class WordsController < ApplicationController
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@syllabus = Syllabus.find(params[:id]);
|
@syllabus = Syllabus.find(params[:id]);
|
||||||
if params[:comment].size>0 && User.current.logged? && @user
|
if params[:comment].size>0 && User.current.logged? && @user
|
||||||
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id])
|
feedback = Syllabus.add_syllabus_jour(@user, params[:comment], params[:id], @syllabus.id)
|
||||||
if (feedback.errors.empty?)
|
if (feedback.errors.empty?)
|
||||||
if params[:asset_id]
|
if params[:asset_id]
|
||||||
ids = params[:asset_id].split(',')
|
ids = params[:asset_id].split(',')
|
||||||
|
@ -296,7 +298,7 @@ class WordsController < ApplicationController
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@homework_common = HomeworkCommon.find(params[:id]);
|
@homework_common = HomeworkCommon.find(params[:id]);
|
||||||
if params[:homework_message].size>0 && User.current.logged? && @user
|
if params[:homework_message].size>0 && User.current.logged? && @user
|
||||||
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id])
|
feedback = HomeworkCommon.add_homework_jour(@user, params[:homework_message], params[:id], @homework_common.id)
|
||||||
if (feedback.errors.empty?)
|
if (feedback.errors.empty?)
|
||||||
if params[:asset_id]
|
if params[:asset_id]
|
||||||
ids = params[:asset_id].split(',')
|
ids = params[:asset_id].split(',')
|
||||||
|
@ -329,7 +331,7 @@ class WordsController < ApplicationController
|
||||||
reply = JournalsForMessage.find params[:id].to_i
|
reply = JournalsForMessage.find params[:id].to_i
|
||||||
@homework_common = HomeworkCommon.find reply.jour_id
|
@homework_common = HomeworkCommon.find reply.jour_id
|
||||||
if params[:reply_message].size>0 && User.current.logged? && @user
|
if params[:reply_message].size>0 && User.current.logged? && @user
|
||||||
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
|
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
|
||||||
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, options)
|
feedback = HomeworkCommon.add_homework_jour(@user, params[:reply_message], reply.jour_id, options)
|
||||||
if (feedback.errors.empty?)
|
if (feedback.errors.empty?)
|
||||||
if params[:asset_id]
|
if params[:asset_id]
|
||||||
|
@ -363,7 +365,7 @@ class WordsController < ApplicationController
|
||||||
reply = JournalsForMessage.find params[:id].to_i
|
reply = JournalsForMessage.find params[:id].to_i
|
||||||
@syllabus = Syllabus.find reply.jour_id
|
@syllabus = Syllabus.find reply.jour_id
|
||||||
if params[:reply_message].size>0 && User.current.logged? && @user
|
if params[:reply_message].size>0 && User.current.logged? && @user
|
||||||
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
|
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => @user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i, :root_id => reply.root_id}
|
||||||
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
|
feedback = Syllabus.add_syllabus_jour(@user, params[:reply_message], reply.jour_id, options)
|
||||||
if (feedback.errors.empty?)
|
if (feedback.errors.empty?)
|
||||||
if params[:asset_id]
|
if params[:asset_id]
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Attachment < ActiveRecord::Base
|
||||||
validates :filename, presence: true, length: {maximum: 254}
|
validates :filename, presence: true, length: {maximum: 254}
|
||||||
validates :author, presence: true
|
validates :author, presence: true
|
||||||
validates :disk_filename, length: {maximum: 254}
|
validates :disk_filename, length: {maximum: 254}
|
||||||
validates :description, length: {maximum: 254}
|
# validates :description, length: {maximum: 254}
|
||||||
validate :validate_max_file_size
|
validate :validate_max_file_size
|
||||||
|
|
||||||
#elasticsearch
|
#elasticsearch
|
||||||
|
|
|
@ -19,7 +19,7 @@ class BlogComment < ActiveRecord::Base
|
||||||
validates_presence_of :title, :content
|
validates_presence_of :title, :content
|
||||||
validates_length_of :title, :maximum => 255
|
validates_length_of :title, :maximum => 255
|
||||||
#validate :cannot_reply_to_locked_comment, :on => :create
|
#validate :cannot_reply_to_locked_comment, :on => :create
|
||||||
safe_attributes 'title', 'content',"sticky", "locked"
|
safe_attributes 'title', 'content',"sticky", "locked", "root_id"
|
||||||
|
|
||||||
after_save :add_user_activity
|
after_save :add_user_activity
|
||||||
after_update :update_activity
|
after_update :update_activity
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Course < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id
|
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id, :end_time, :end_term
|
||||||
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
|
||||||
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表
|
||||||
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表
|
||||||
|
@ -96,7 +96,9 @@ class Course < ActiveRecord::Base
|
||||||
'class_period',
|
'class_period',
|
||||||
'open_student',
|
'open_student',
|
||||||
'is_delete',
|
'is_delete',
|
||||||
'syllabus_id'
|
'syllabus_id',
|
||||||
|
'end_time',
|
||||||
|
'end_term'
|
||||||
|
|
||||||
acts_as_customizable
|
acts_as_customizable
|
||||||
|
|
||||||
|
|
|
@ -113,10 +113,10 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
###添加回复
|
###添加回复
|
||||||
def self.add_homework_jour(user, notes, id , options = {})
|
def self.add_homework_jour(user, notes, id, root_id, options = {})
|
||||||
homework = HomeworkCommon.find(id)
|
homework = HomeworkCommon.find(id)
|
||||||
if options.count == 0
|
if options.count == 0
|
||||||
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
|
jfm = homework.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
|
||||||
else
|
else
|
||||||
jfm = homework.journals_for_messages.build(options)
|
jfm = homework.journals_for_messages.build(options)
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,8 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
"m_reply_count", # 留言的回复数量
|
"m_reply_count", # 留言的回复数量
|
||||||
"m_reply_id" , # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
"m_reply_id" , # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
||||||
"is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言
|
"is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言
|
||||||
"private"
|
"private",
|
||||||
|
"root_id"
|
||||||
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
|
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
|
||||||
after_destroy :delete_kindeditor_assets
|
after_destroy :delete_kindeditor_assets
|
||||||
belongs_to :project,
|
belongs_to :project,
|
||||||
|
|
|
@ -96,7 +96,7 @@ class Message < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
safe_attributes 'subject', 'content', 'reply_id'
|
safe_attributes 'subject', 'content', 'reply_id', 'root_id'
|
||||||
safe_attributes 'board_id','locked', 'sticky',
|
safe_attributes 'board_id','locked', 'sticky',
|
||||||
:if => lambda {|message, user|
|
:if => lambda {|message, user|
|
||||||
if message.project
|
if message.project
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class OrgDocumentComment < ActiveRecord::Base
|
class OrgDocumentComment < ActiveRecord::Base
|
||||||
# status: 1 模式二中置顶 0:模式二中正常显示
|
# status: 1 模式二中置顶 0:模式二中正常显示
|
||||||
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status
|
attr_accessible :content, :creator_id, :organization_id, :parent_id, :reply_id, :title, :sticky, :locked, :status, :root_id
|
||||||
include Redmine::SafeAttributes
|
include Redmine::SafeAttributes
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
belongs_to :organization
|
belongs_to :organization
|
||||||
|
|
|
@ -65,10 +65,10 @@ class Syllabus < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
###添加回复
|
###添加回复
|
||||||
def self.add_syllabus_jour(user, notes, id , options = {})
|
def self.add_syllabus_jour(user, notes, id, root_id, options = {})
|
||||||
syllabus = Syllabus.find(id)
|
syllabus = Syllabus.find(id)
|
||||||
if options.count == 0
|
if options.count == 0
|
||||||
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0)
|
jfm = syllabus.journals_for_messages.build(:user_id => user.id, :notes => notes, :reply_id => 0, :root_id => root_id)
|
||||||
else
|
else
|
||||||
jfm = syllabus.journals_for_messages.build(options)
|
jfm = syllabus.journals_for_messages.build(options)
|
||||||
end
|
end
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, @article) %>
|
<% all_replies = BlogComment.where("root_id = #{@article.id}").reorder("created_on desc") %>
|
||||||
<% count= all_replies.count %>
|
<% count= all_replies.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<div class="homepagePostReplyBanner">
|
<div class="homepagePostReplyBanner">
|
||||||
|
|
|
@ -36,12 +36,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</li>
|
</li>
|
||||||
<% count=0 %>
|
|
||||||
<% if activity.parent %>
|
<% count=BlogComment.where("root_id = #{activity.id}").count%>
|
||||||
<% count=activity.parent.children.count%>
|
|
||||||
<% else %>
|
|
||||||
<% count=activity.children.count%>
|
|
||||||
<% end %>
|
|
||||||
<li class="ml15">
|
<li class="ml15">
|
||||||
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
|
<span class="grayTxt">发布:<%= format_time(activity.created_on) %></span>
|
||||||
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>
|
<span class="grayTxt">更新:<%= format_time(activity.updated_on) %></span>
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_repies = get_all_children(all_comments, activity) %>
|
<% all_repies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
|
||||||
<% count = all_repies.count %>
|
<% count = all_repies.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<%= render :partial => 'users/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} %>
|
||||||
|
|
|
@ -43,8 +43,10 @@
|
||||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
||||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||||
</div>
|
</div>
|
||||||
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
<%= form_tag(edit_file_description_org_subfield_file_path(file, :org_subfield_id => org_subfield.id ),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
|
||||||
onblur="edit_file_description('<%= update_file_description_org_subfield_file_path(file.container,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
|
||||||
|
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="fontGrey2 mb4">
|
<div class="fontGrey2 mb4">
|
||||||
|
@ -108,3 +110,8 @@
|
||||||
<%end%>
|
<%end%>
|
||||||
<% end%>
|
<% end%>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function commit_files_description(id) {
|
||||||
|
$(id).submit();
|
||||||
|
}
|
||||||
|
</script>
|
|
@ -40,8 +40,10 @@
|
||||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
||||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||||
</div>
|
</div>
|
||||||
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
<%= form_tag(edit_file_description_project_file_path(file, :project_id => project.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
|
||||||
onblur="edit_file_description('<%= update_file_description_project_file_path(project,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
|
||||||
|
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="fontGrey2 mb4">
|
<div class="fontGrey2 mb4">
|
||||||
|
@ -70,6 +72,11 @@
|
||||||
<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%>
|
<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true%>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function commit_files_description(id) {
|
||||||
|
$(id).submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,10 @@
|
||||||
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
<div id="file_description_show_<%= file.id %>" class="fontGrey2 mb4">
|
||||||
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
<%= render :partial => 'files/file_description', :locals => {:file => file} %>
|
||||||
</div>
|
</div>
|
||||||
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" id="file_description_edit_<%= file.id %>"
|
<%= form_tag(edit_file_description_course_file_path(file, :course_id => @course.id),:remote=>'true', :method => :post, :id=>"files_query_form_#{file.id}") do %>
|
||||||
onblur="edit_file_description('<%= update_file_description_course_file_path(@course,file)%>','<%= file.id %>');"><%= file.description %></textarea>
|
<textarea style="resize: none;max-width: none;margin-left: 0" class="homepageSignatureTextarea W600 none " placeholder="请编辑资源描述" name="file_description_edit" id="file_description_edit_<%= file.id %>"
|
||||||
|
onblur="commit_files_description('#files_query_form_<%= file.id %>');"><%= file.description %></textarea>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="fontGrey2 mb4">
|
<div class="fontGrey2 mb4">
|
||||||
|
@ -99,4 +101,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
<script>
|
||||||
|
function commit_files_description(id) {
|
||||||
|
$(id).submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
$("#file_description_show_<%= @attachment.id %>").html("<%= escape_javascript render(:partial => "files/file_description", :locals => {:file => @attachment}) %>");
|
||||||
|
$("#file_description_show_<%= @attachment.id %>").show();
|
||||||
|
$("#file_description_edit_<%= @attachment.id %>").hide();
|
|
@ -35,5 +35,5 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => "layouts/no_content" %>
|
<%#= render :partial => "layouts/no_content" %>
|
||||||
<% end %>
|
<% end %>
|
|
@ -14,9 +14,12 @@
|
||||||
<li class="navHomepageMenu fl">
|
<li class="navHomepageMenu fl">
|
||||||
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
||||||
</li>
|
</li>
|
||||||
<li class="navHomepageMenu fl mr30">
|
<% memo = Memo.where(:id => 1168).first %>
|
||||||
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
|
<% unless memo.nil? %>
|
||||||
</li>
|
<li class="navHomepageMenu fl mr30">
|
||||||
|
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li class="navHomepageMenu fl mr40">
|
<li class="navHomepageMenu fl mr40">
|
||||||
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" >公共贴吧</a>
|
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" >公共贴吧</a>
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, @document) %>
|
<% all_replies = OrgDocumentComment.where("root_id = #{@document.id}").reorder("created_at desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
|
|
||||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
|
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, activity) %>
|
<% all_replies = OrgDocumentComment.where("root_id = #{activity.id}").reorder("created_at desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>
|
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, document) %>
|
<% all_replies = OrgDocumentComment.where("root_id = #{document.id}").reorder("created_at desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
|
|
||||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">
|
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
<% if User.current.member_of_course?(course) %>
|
<% if User.current.member_of_course?(course) %>
|
||||||
<%=link_to '进入班级', course_path(course), :class => 'btn_orange_big fr mt5', :target => '_blank' %>
|
<%=link_to '进入班级', course_path(course), :class => 'btn_orange_big fr mt5', :target => '_blank' %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "btn_green_big fr mt5",:method => "post"%>
|
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green2 fr mt5",:method => "post"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
|
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% count=get_all_children(all_comments, activity).count %>
|
<% count=Message.where("root_id = #{activity.id}").count %>
|
||||||
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
|
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, activity) %>
|
<% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<%= render :partial => 'users/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} %>
|
||||||
|
|
|
@ -81,7 +81,8 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, activity) %>
|
<%# all_replies = get_all_children(all_comments, activity) %>
|
||||||
|
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<%= render :partial => 'users/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} %>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
</span>
|
</span>
|
||||||
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
|
<span class="grayTxt">更新:<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% count=get_all_children(all_comments, activity).count %>
|
<% count=Message.where("root_id = #{activity.id}").count %>
|
||||||
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
|
<p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, activity) %>
|
<% all_replies = Message.where("root_id = #{activity.id}").reorder("created_on desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
<%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
|
<%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
|
||||||
<%# count = fetch_user_leaveWord_reply(activity).count %>
|
<%# count = fetch_user_leaveWord_reply(activity).count %>
|
||||||
|
|
|
@ -41,8 +41,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<%# all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, activity) %>
|
<% all_replies = BlogComment.where("root_id = #{activity.id}").reorder("created_on desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 0} %>
|
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 0} %>
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
<% all_comments = []%>
|
<% all_comments = []%>
|
||||||
<% all_replies = get_all_children(all_comments, activity) %>
|
<% all_replies = JournalsForMessage.where("root_id = #{activity.id}").reorder("created_on desc") %>
|
||||||
<% count = all_replies.count %>
|
<% count = all_replies.count %>
|
||||||
<div class="homepagePostReply">
|
<div class="homepagePostReply">
|
||||||
<%= render :partial => 'users/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} %>
|
||||||
|
|
|
@ -133,6 +133,7 @@ RedmineApp::Application.routes.draw do
|
||||||
member do
|
member do
|
||||||
match "quote_resource_show_org_subfield", :via => [:get]
|
match "quote_resource_show_org_subfield", :via => [:get]
|
||||||
get "update_file_description"
|
get "update_file_description"
|
||||||
|
post "edit_file_description"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -809,6 +810,7 @@ RedmineApp::Application.routes.draw do
|
||||||
match "quote_resource_show", :via => [:get]
|
match "quote_resource_show", :via => [:get]
|
||||||
get "file_hidden"
|
get "file_hidden"
|
||||||
get "update_file_description"
|
get "update_file_description"
|
||||||
|
post "edit_file_description"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1219,6 +1221,7 @@ RedmineApp::Application.routes.draw do
|
||||||
get "file_hidden"
|
get "file_hidden"
|
||||||
post "republish_file"
|
post "republish_file"
|
||||||
get "update_file_description"
|
get "update_file_description"
|
||||||
|
post "edit_file_description"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
|
resources :memberships, :shallow => true, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class ChangeDescriptionForAttachment < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
change_column :attachments, :description, :text
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
change_column :attachments, :description, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,73 @@
|
||||||
|
class AddRootId < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :messages, :root_id, :integer, :default => nil
|
||||||
|
add_column :journals_for_messages, :root_id, :integer, :default => nil
|
||||||
|
add_column :blog_comments, :root_id, :integer, :default => nil
|
||||||
|
add_column :org_document_comments, :root_id, :integer, :default => nil
|
||||||
|
|
||||||
|
add_index :messages, :root_id
|
||||||
|
add_index :journals_for_messages,:root_id
|
||||||
|
add_index :blog_comments,:root_id
|
||||||
|
add_index :org_document_comments,:root_id
|
||||||
|
|
||||||
|
def get_base_parent comment
|
||||||
|
comm = comment
|
||||||
|
while comm.parent
|
||||||
|
comm = comm.parent
|
||||||
|
end
|
||||||
|
comm
|
||||||
|
end
|
||||||
|
|
||||||
|
count = Message.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
Message.page(i).per(30).each do |message|
|
||||||
|
unless message.parent.nil?
|
||||||
|
parent = get_base_parent message
|
||||||
|
message.update_column('root_id', parent.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
count = JournalsForMessage.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
JournalsForMessage.page(i).per(30).each do |message|
|
||||||
|
if message.jour_type == "HomeworkCommon" || message.jour_type == "Syllabus"
|
||||||
|
message.update_column('root_id', message.jour_id)
|
||||||
|
else
|
||||||
|
unless message.parent.nil?
|
||||||
|
parent = get_base_parent message
|
||||||
|
message.update_column('root_id', parent.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
count = BlogComment.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
BlogComment.page(i).per(30).each do |message|
|
||||||
|
unless message.parent.nil?
|
||||||
|
parent = get_base_parent message
|
||||||
|
message.update_column('root_id', parent.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
count = OrgDocumentComment.all.count / 30 + 2
|
||||||
|
transaction do
|
||||||
|
for i in 1 ... count do i
|
||||||
|
OrgDocumentComment.page(i).per(30).each do |message|
|
||||||
|
unless message.parent.nil?
|
||||||
|
parent = get_base_parent message
|
||||||
|
message.update_column('root_id', parent.id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
45
db/schema.rb
45
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20160921062340) do
|
ActiveRecord::Schema.define(:version => 20161011012114) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -165,7 +165,7 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.integer "downloads", :default => 0, :null => false
|
t.integer "downloads", :default => 0, :null => false
|
||||||
t.integer "author_id", :default => 0, :null => false
|
t.integer "author_id", :default => 0, :null => false
|
||||||
t.datetime "created_on"
|
t.datetime "created_on"
|
||||||
t.string "description"
|
t.text "description"
|
||||||
t.string "disk_directory"
|
t.string "disk_directory"
|
||||||
t.integer "attachtype", :default => 1
|
t.integer "attachtype", :default => 1
|
||||||
t.integer "is_public", :default => 1
|
t.integer "is_public", :default => 1
|
||||||
|
@ -249,8 +249,11 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.integer "reply_id"
|
t.integer "reply_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
|
t.integer "root_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "blog_comments", ["root_id"], :name => "index_blog_comments_on_root_id"
|
||||||
|
|
||||||
create_table "blogs", :force => true do |t|
|
create_table "blogs", :force => true do |t|
|
||||||
t.string "name", :default => "", :null => false
|
t.string "name", :default => "", :null => false
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
@ -569,8 +572,8 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.string "code"
|
t.string "code"
|
||||||
t.integer "time"
|
t.integer "time"
|
||||||
t.string "extra"
|
t.string "extra"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "location"
|
t.string "location"
|
||||||
t.string "term"
|
t.string "term"
|
||||||
t.string "string"
|
t.string "string"
|
||||||
|
@ -580,25 +583,26 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.string "class_period"
|
t.string "class_period"
|
||||||
t.integer "school_id"
|
t.integer "school_id"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "status", :default => 1
|
t.integer "status", :default => 1
|
||||||
t.integer "attachmenttype", :default => 2
|
t.integer "attachmenttype", :default => 2
|
||||||
t.integer "lft"
|
t.integer "lft"
|
||||||
t.integer "rgt"
|
t.integer "rgt"
|
||||||
t.integer "is_public", :limit => 1, :default => 1
|
t.integer "is_public", :limit => 1, :default => 1
|
||||||
t.integer "inherit_members", :limit => 1, :default => 1
|
t.integer "inherit_members", :limit => 1, :default => 1
|
||||||
t.integer "open_student", :default => 0
|
t.integer "open_student", :default => 0
|
||||||
t.integer "outline", :default => 0
|
t.integer "outline", :default => 0
|
||||||
t.integer "publish_resource", :default => 0
|
t.integer "publish_resource", :default => 0
|
||||||
t.integer "is_delete", :default => 0
|
t.integer "is_delete", :default => 0
|
||||||
t.integer "end_time"
|
t.integer "end_time"
|
||||||
t.string "end_term"
|
t.string "end_term"
|
||||||
t.integer "is_excellent", :default => 0
|
t.integer "is_excellent", :default => 0
|
||||||
t.integer "excellent_option", :default => 0
|
t.integer "excellent_option", :default => 0
|
||||||
t.integer "is_copy", :default => 0
|
t.integer "is_copy", :default => 0
|
||||||
t.integer "visits", :default => 0
|
t.integer "visits", :default => 0
|
||||||
t.integer "syllabus_id"
|
t.integer "syllabus_id"
|
||||||
t.string "invite_code"
|
t.string "invite_code"
|
||||||
t.string "qrcode"
|
t.string "qrcode"
|
||||||
|
t.integer "qrcode_expiretime", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
|
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
|
||||||
|
@ -1111,8 +1115,11 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.integer "m_reply_id"
|
t.integer "m_reply_id"
|
||||||
t.integer "is_comprehensive_evaluation"
|
t.integer "is_comprehensive_evaluation"
|
||||||
t.integer "private", :default => 0
|
t.integer "private", :default => 0
|
||||||
|
t.integer "root_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "journals_for_messages", ["root_id"], :name => "index_journals_for_messages_on_root_id"
|
||||||
|
|
||||||
create_table "kindeditor_assets", :force => true do |t|
|
create_table "kindeditor_assets", :force => true do |t|
|
||||||
t.string "asset"
|
t.string "asset"
|
||||||
t.integer "file_size"
|
t.integer "file_size"
|
||||||
|
@ -1203,6 +1210,7 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.integer "reply_id"
|
t.integer "reply_id"
|
||||||
t.integer "quotes"
|
t.integer "quotes"
|
||||||
t.integer "status", :default => 0
|
t.integer "status", :default => 0
|
||||||
|
t.integer "root_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
|
add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
|
||||||
|
@ -1210,6 +1218,7 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
|
add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
|
||||||
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
|
add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
|
||||||
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
add_index "messages", ["parent_id"], :name => "messages_parent_id"
|
||||||
|
add_index "messages", ["root_id"], :name => "index_messages_on_root_id"
|
||||||
|
|
||||||
create_table "news", :force => true do |t|
|
create_table "news", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
|
@ -1336,8 +1345,11 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.integer "sticky", :default => 0
|
t.integer "sticky", :default => 0
|
||||||
t.integer "org_subfield_id"
|
t.integer "org_subfield_id"
|
||||||
t.integer "status", :default => 0
|
t.integer "status", :default => 0
|
||||||
|
t.integer "root_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "org_document_comments", ["root_id"], :name => "index_org_document_comments_on_root_id"
|
||||||
|
|
||||||
create_table "org_member_roles", :force => true do |t|
|
create_table "org_member_roles", :force => true do |t|
|
||||||
t.integer "org_member_id"
|
t.integer "org_member_id"
|
||||||
t.integer "role_id"
|
t.integer "role_id"
|
||||||
|
@ -1563,6 +1575,7 @@ ActiveRecord::Schema.define(:version => 20160921062340) do
|
||||||
t.integer "hot", :default => 0
|
t.integer "hot", :default => 0
|
||||||
t.string "invite_code"
|
t.string "invite_code"
|
||||||
t.string "qrcode"
|
t.string "qrcode"
|
||||||
|
t.integer "qrcode_expiretime", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||||
|
|
Loading…
Reference in New Issue