Merge branch 'szzh' into dev_hjq

Conflicts:
	db/schema.rb
	public/stylesheets/share.css
This commit is contained in:
ouyangxuhua 2016-01-14 14:40:13 +08:00
commit a1f8db65fc
75 changed files with 625 additions and 268 deletions

View File

@ -53,6 +53,7 @@ class AtController < ApplicationController
end end
def find_project(id) def find_project(id)
return [] if id<0
at_persons = Project.find(id).users at_persons = Project.find(id).users
at_persons.delete_if { |u| u.id == User.current.id } at_persons.delete_if { |u| u.id == User.current.id }
end end

View File

@ -54,16 +54,9 @@ class CommentsController < ApplicationController
# end # end
# # <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add end # # <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD>ļ<EFBFBD>¼add end
#flash[:notice] = l(:label_comment_added) #flash[:notice] = l(:label_comment_added)
course_activity = CourseActivity.where("course_act_type='News' and course_act_id =#{@news.id}").first update_course_activity(@news.class,@news.id)
if course_activity update_user_activity(@news.class,@news.id)
course_activity.updated_at = Time.now update_org_activity(@news.class,@news.id)
course_activity.save
end
user_activity = UserActivity.where("act_type='News' and act_id =#{@news.id}").first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
end end
if params[:user_activity_id] if params[:user_activity_id]

View File

@ -17,7 +17,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class FilesController < ApplicationController class FilesController < ApplicationController
layout 'base_projects' #by young layout 'base_projects' #by young
menu_item :files menu_item :files
@ -456,6 +455,9 @@ class FilesController < ApplicationController
end end
end end
end end
# 更新资源总数, 根据上传的附件数累加
@project.update_attribute(:attachments_count, @project.attachments_count + attachments[:files].count)
# end
# TODO: 临时用 nyan # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
@ -484,9 +486,6 @@ class FilesController < ApplicationController
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
Mailer.run.attachments_added(attachments[:files]) Mailer.run.attachments_added(attachments[:files])
end end
# 更新课程英雄榜得分
update_contributor_score(@course, attachments[:files].first)
# end
if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array) if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
params[:course_attachment_type].each do |type| params[:course_attachment_type].each do |type|
tag_name = get_tag_name_by_type_number type tag_name = get_tag_name_by_type_number type
@ -508,8 +507,9 @@ class FilesController < ApplicationController
end end
end end
end end
# 更新课程英雄榜得分
update_contributor_score(@course, attachments[:files].first)
# end
# TODO: 临时用 nyan # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on", sort_update 'created_on' => "#{Attachment.table_name}.created_on",
@ -830,5 +830,5 @@ class FilesController < ApplicationController
def upload_files_menu def upload_files_menu
end end
end end

View File

@ -405,9 +405,9 @@ class IssuesController < ApplicationController
jour.journalized = @issue jour.journalized = @issue
jour.save_attachments(params[:attachments]) jour.save_attachments(params[:attachments])
jour.save jour.save
user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first update_user_activity(@issue.class,@issue.id)
user_activity.updated_at = jour.created_on update_forge_activity(@issue.class,@issue.id)
user_activity.save
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]
if params[:issue_id] if params[:issue_id]
@issue_id = params[:issue_id] @issue_id = params[:issue_id]
@ -455,9 +455,9 @@ class IssuesController < ApplicationController
@issue = Issue.find params[:id] @issue = Issue.find params[:id]
jour.journalized = @issue jour.journalized = @issue
jour.save jour.save
user_activity = UserActivity.where("act_type='Issue' and act_id =#{@issue.id}").first update_user_activity(@issue.class,@issue.id)
user_activity.updated_at = jour.created_on update_forge_activity(@issue.class,@issue.id)
user_activity.save
respond_to do |format| respond_to do |format|
format.js format.js
end end

View File

@ -176,26 +176,11 @@ class MessagesController < ApplicationController
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject] @reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
# @reply.reply_id = params[:id] # @reply.reply_id = params[:id]
@topic.children << @reply @topic.children << @reply
course_activity = CourseActivity.where("course_act_type='Message' and course_act_id =#{@topic.id}").first update_course_activity(@topic.class,@topic.id)
if course_activity update_user_activity(@topic.class,@topic.id)
course_activity.updated_at = Time.now update_forge_activity(@topic.class,@topic.id)
course_activity.save update_org_activity(@topic.class,@topic.id)
end
forge_activity = ForgeActivity.where("forge_act_type='Message' and forge_act_id=#{@topic.id}").first
if forge_activity
forge_activity.updated_at = Time.now
forge_activity.save
end
user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
org_activity = OrgActivity.where("org_act_type='Message' and org_act_id =#{@topic.id}").first
if org_activity
org_activity.updated_at = Time.now
org_activity.save
end
#@topic.update_attribute(:updated_on, Time.now) #@topic.update_attribute(:updated_on, Time.now)
if !@reply.new_record? if !@reply.new_record?
if params[:asset_id] if params[:asset_id]

View File

@ -344,20 +344,15 @@ update
#Modified by young #Modified by young
# (show_error_not_found; return) unless @entries # (show_error_not_found; return) unless @entries
g = Gitlab.client g = Gitlab.client
# count = 0
# (0..100).each do |page|
# if g.commits(@project.gpid,:page => page).count == 0
# break
# else
# count = count + g.commits(@project.gpid,:page => page).count
# end
# end
@changesets = g.commits(@project.gpid, :ref_name => @rev) @changesets = g.commits(@project.gpid, :ref_name => @rev)
# @changesets = @repository.latest_changesets(@path, @rev) # @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count # @changesets_count = @repository.latest_changesets(@path, @rev).count
@changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count @changesets_all_count = @project.gpid.nil? ? 0 : g.project(@project.gpid).commit_count
# 访问该页面的是会后则刷新
if @changesets_all_count != @project.commits_count && @changesets_all_count != 0
update_commits_count(@project, @changesets_all_count)
end
# end
@changesets_latest_coimmit = @changesets[0] @changesets_latest_coimmit = @changesets[0]
@properties = @repository.properties(@path, @rev) @properties = @repository.properties(@path, @rev)
@repositories = @project.repositories @repositories = @project.repositories
@ -583,6 +578,10 @@ update
end end
private private
# 更新项目统计数
def update_commits_count project, count
project.update_attribute(:commits_count, count)
end
def find_repository def find_repository
@repository = Repository.find(params[:id]) @repository = Repository.find(params[:id])

View File

@ -259,16 +259,10 @@ class StudentWorkController < ApplicationController
stu_project.save stu_project.save
end end
end end
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first update_course_activity(@homework.class,@homework.id)
if course_activity update_user_activity(@homework.class,@homework.id)
course_activity.updated_at = Time.now update_org_activity(@homework.class,@homework.id)
course_activity.save
end
user_activity = UserActivity.where("act_type='HomeworkCommon' and act_id =#{@homework.id}").first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录 course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"new",:course_message_id=>student_work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
course_message.save course_message.save

View File

@ -57,21 +57,11 @@ class WordsController < ApplicationController
@jfm = add_reply_adapter options @jfm = add_reply_adapter options
@save_succ = true if @jfm.errors.empty? @save_succ = true if @jfm.errors.empty?
if @save_succ if @save_succ
course_activity = CourseActivity.where("course_act_type='JournalsForMessage' and course_act_id =#{parent_id}").first update_course_activity('JournalsForMessage',parent_id)
if course_activity update_user_activity('JournalsForMessage',parent_id)
course_activity.updated_at = Time.now update_forge_activity('JournalsForMessage',parent_id)
course_activity.save update_org_activity('JournalsForMessage',parent_id)
end update_principal_activity('JournalsForMessage',parent_id)
principal_activity = PrincipalActivity.where("principal_act_type='JournalsForMessage' and principal_act_id =#{parent_id}").first
if principal_activity
principal_activity.updated_at = Time.now
principal_activity.save
end
user_activity = UserActivity.where("act_type='JournalsForMessage' and act_id =#{parent_id}").first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
end end
respond_to do |format| respond_to do |format|
# format.html { # format.html {
@ -278,16 +268,9 @@ class WordsController < ApplicationController
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
end end
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework_common.id}").first update_course_activity(@homework_common.class,@homework_common.id)
if course_activity update_user_activity(@homework_common.class,@homework_common.id)
course_activity.updated_at = Time.now update_org_activity(@homework_common.class,@homework_common.id)
course_activity.save
end
user_activity = UserActivity.where("act_type='HomeworkCommon' and act_id =#{@homework_common.id}").first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
respond_to do |format| respond_to do |format|
format.js{ format.js{
@user_activity_id = params[:user_activity_id] @user_activity_id = params[:user_activity_id]

View File

@ -49,6 +49,12 @@ module ApplicationHelper
end end
end end
# 获取项目/课程总分
# 发布缺陷 4分 回复缺陷 1分 提交一次 4分 讨论帖子 2分 回复帖子 1分 发布新闻 1分
def static_project_score obj
score = obj.issues_count * 4 + obj.journals_count + obj.commits_count * 4 + obj.boards_count * 2 + obj.boards_reply_count + obj.news_count + obj.attachments_count * 5
end
# 获取组织成员中文名字 # 获取组织成员中文名字
def get_org_member_role_name member def get_org_member_role_name member
case member.roles[0].name case member.roles[0].name
@ -2787,4 +2793,45 @@ int main(int argc, char** argv){
project.gpid.nil? ? 0 : g.project(project.gpid).commit_count project.gpid.nil? ? 0 : g.project(project.gpid).commit_count
# project.changesets.count # project.changesets.count
end end
#课程动态的更新
def update_course_activity type, id
course_activity = CourseActivity.where("course_act_type=? and course_act_id =?", type.to_s, id).first
if course_activity
course_activity.updated_at = Time.now
course_activity.save
end
end
#首页动态更新
def update_user_activity type, id
user_activity = UserActivity.where("act_type=? and act_id =?", type.to_s, id).first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
end
#项目动态更新
def update_forge_activity type, id
forge_activity = ForgeActivity.where("forge_act_type=? and forge_act_id=?", type.to_s, id).first
if forge_activity
forge_activity.updated_at = Time.now
forge_activity.save
end
end
#组织动态更新
def update_org_activity type , id
org_activity = OrgActivity.where("org_act_type=? and org_act_id =?", type.to_s, id).first
if org_activity
org_activity.updated_at = Time.now
org_activity.save
end
end
#个人动态更新
def update_principal_activity type, id
principal_activity = PrincipalActivity.where("principal_act_type=? and principal_act_id =?", type.to_s, id).first
if principal_activity
principal_activity.updated_at = Time.now
principal_activity.save
end
end
end end

View File

@ -507,8 +507,10 @@ module CoursesHelper
#课程实践年份下拉框 #课程实践年份下拉框
def course_time_option year def course_time_option year
type = [] type = []
month = Time.now.month
now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year) now_year = year.nil? ? Time.now.year : (Time.now.year <= year ? Time.now.year : year)
for i in (now_year..now_year + 10) year = month < 3 ? now_year - 1 : now_year
for i in (year..year + 10)
option = [] option = []
option << i option << i
option << i option << i

View File

@ -90,7 +90,7 @@ class Attachment < ActiveRecord::Base
before_save :files_to_final_location,:act_as_course_activity before_save :files_to_final_location,:act_as_course_activity
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index#, :decrease_attchments_count
# add by nwb # add by nwb
# 获取所有可公开的资源文件列表 # 获取所有可公开的资源文件列表
@ -617,6 +617,7 @@ class Attachment < ActiveRecord::Base
self.__elasticsearch__.index_document self.__elasticsearch__.index_document
end end
end end
def update_attachment_ealasticsearch_index def update_attachment_ealasticsearch_index
if self.is_public == 1 && ( ((self.container_type == 'Project' or self.container_type == 'Version') && Project.find(self.container_id).is_public == 1) || if self.is_public == 1 && ( ((self.container_type == 'Project' or self.container_type == 'Version') && Project.find(self.container_id).is_public == 1) ||
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) || ( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
@ -632,12 +633,20 @@ class Attachment < ActiveRecord::Base
end end
end end
end end
def delete_attachment_ealasticsearch_index def delete_attachment_ealasticsearch_index
begin begin
self.__elasticsearch__.delete_document self.__elasticsearch__.delete_document
rescue => e rescue => e
end end
end end
# def decrease_attchments_count
# if self.container_type == "Project"
# count = self.container.attachments_count
# #self.container.update_attribute(:attachments_count, self.container.attachments_count - 1)
# end
# end
end end
# Delete the previous articles index in Elasticsearch # Delete the previous articles index in Elasticsearch

View File

@ -17,6 +17,7 @@ class BlogComment < ActiveRecord::Base
safe_attributes 'title', 'content',"sticky", "locked" safe_attributes 'title', 'content',"sticky", "locked"
after_save :add_user_activity after_save :add_user_activity
after_update :update_activity
before_destroy :destroy_user_activity before_destroy :destroy_user_activity
scope :like, lambda {|arg| scope :like, lambda {|arg|
@ -28,6 +29,15 @@ class BlogComment < ActiveRecord::Base
end end
} }
#动态更新
def update_activity
user_activity = UserActivity.where("act_type='BlogComment' and act_id =?",self.id).first
if user_activity
user_activity.updated_at = Time.now
user_activity.save
end
end
#在个人动态里面增加当前动态 #在个人动态里面增加当前动态
def add_user_activity def add_user_activity
if self.parent_id.nil? #只有发博文才插入动态 if self.parent_id.nil? #只有发博文才插入动态

View File

@ -70,7 +70,7 @@ class Course < ActiveRecord::Base
validates_length_of :description, :maximum => 10000 validates_length_of :description, :maximum => 10000
before_save :self_validate before_save :self_validate
# 公开课程变成私有课程,所有资源都变成私有 # 公开课程变成私有课程,所有资源都变成私有
after_update :update_files_public,:update_course_ealasticsearch_index after_update :update_files_public,:update_course_ealasticsearch_index,:update_activity
after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index
before_destroy :delete_all_members,:delete_course_ealasticsearch_index before_destroy :delete_all_members,:delete_course_ealasticsearch_index
@ -428,6 +428,12 @@ class Course < ActiveRecord::Base
end end
end end
end end
#动态的更新
def update_activity
update_course_activity(self.class, self.id)
update_user_activity(self.class, self.id)
update_org_activity(self.class, self.id)
end
# Delete the previous articles index in Elasticsearch # Delete the previous articles index in Elasticsearch
# Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil # Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil

View File

@ -20,8 +20,8 @@ class ForgeActivity < ActiveRecord::Base
validates :forge_act_id,presence: true validates :forge_act_id,presence: true
validates :forge_act_type, presence: true validates :forge_act_type, presence: true
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
after_save :add_user_activity, :add_org_activity after_save :add_user_activity, :add_org_activity, :add_acts_count
before_destroy :destroy_user_activity, :destroy_org_activity before_destroy :destroy_user_activity, :destroy_org_activity, :decrease_acts_count
#在个人动态里面增加当前动态 #在个人动态里面增加当前动态
def add_user_activity def add_user_activity
@ -45,6 +45,21 @@ class ForgeActivity < ActiveRecord::Base
end end
end end
# 更新动态数
def add_acts_count
if self.project
count = self.project.acts_count + 1
self.project.update_attribute(:acts_count, count)
end
end
def decrease_acts_count
if self.project
count = self.project.acts_count - 1
self.project.update_attribute(:acts_count, count)
end
end
def add_org_activity def add_org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
if org_activity if org_activity

View File

@ -26,6 +26,7 @@ class HomeworkCommon < ActiveRecord::Base
:author => :author, :author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
after_create :act_as_activity, :send_mail, :act_as_course_message after_create :act_as_activity, :send_mail, :act_as_course_message
after_update :update_activity
after_save :act_as_course_activity after_save :act_as_course_activity
after_destroy :delete_kindeditor_assets after_destroy :delete_kindeditor_assets
@ -60,7 +61,12 @@ class HomeworkCommon < ActiveRecord::Base
end end
end end
end end
#动态的更新
def update_activity
update_course_activity(self.class, self.id)
update_user_activity(self.class, self.id)
update_org_activity(self.class, self.id)
end
#删除对应的图片 #删除对应的图片
def delete_kindeditor_assets def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON

View File

@ -83,9 +83,9 @@ class Issue < ActiveRecord::Base
attr_reader :current_journal attr_reader :current_journal
# fq # fq
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message, :add_issues_count
after_update :be_user_score after_update :be_user_score,:update_activity
after_destroy :down_user_score after_destroy :down_user_score, :decrease_issues_count
# after_create :be_user_score # after_create :be_user_score
# end # end
@ -126,6 +126,12 @@ class Issue < ActiveRecord::Base
after_save :after_create_from_copy after_save :after_create_from_copy
after_destroy :update_parent_attributes after_destroy :update_parent_attributes
#动态的更新
def update_activity
update_user_activity(self.class, self.id)
update_forge_activity(self.class, self.id)
update_org_activity(self.class, self.id)
end
# fq # fq
def act_as_activity def act_as_activity
@ -165,6 +171,18 @@ class Issue < ActiveRecord::Base
end end
end end
# 创建issue的时候issues_count加1
def add_issues_count
issue_count = self.project.issues_count + 1
self.project.update_attribute(:issues_count, issue_count)
end
# 删除issue的时候issues_count减1
def decrease_issues_count
issue_count = self.project.issues_count - 1
self.project.update_attribute(:issues_count, issue_count)
end
# 更新缺陷 # 更新缺陷
#def act_as_forge_message_update #def act_as_forge_message_update
# unless self.author_id == self.assigned_to_id # unless self.author_id == self.assigned_to_id

View File

@ -48,14 +48,14 @@ class Journal < ActiveRecord::Base
:conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" + :conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
"(#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"} "(#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
before_create :split_private_notes before_create :split_private_notes, :add_journals_count
# fq # fq
after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message after_save :act_as_activity,:be_user_score, :act_as_forge_message, :act_as_at_message
# end # end
#after_destroy :down_user_score #after_destroy :down_user_score
#before_save :be_user_score #before_save :be_user_score
after_destroy :down_user_score after_destroy :down_user_score, :decrease_issues_journal_count
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
user = args.shift || User.current user = args.shift || User.current
@ -214,4 +214,20 @@ class Journal < ActiveRecord::Base
end end
end end
# 减少留言数量统计
def decrease_issues_journal_count
unless self.issue.project.nil?
project = self.issue.project
project.update_attribute(:journals_count, project.journals_count - 1)
end
end
# issue留言总数更新
def add_journals_count
unless self.issue.project.nil? && self.journalized_type == "Issue"
project = self.issue.project
project.update_attribute(:journals_count, project.journals_count + 1)
end
end
end end

View File

@ -70,12 +70,21 @@ class JournalsForMessage < ActiveRecord::Base
validates :notes, presence: true, if: :is_homework_jour? validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score
after_create :reset_counters! after_create :reset_counters!
after_update :update_ativity
after_destroy :reset_counters! after_destroy :reset_counters!
after_save :be_user_score after_save :be_user_score
after_destroy :down_user_score after_destroy :down_user_score
# default_scope { where('m_parent_id IS NULL') } # default_scope { where('m_parent_id IS NULL') }
#动态的更新
def update_activity
update_course_activity(self.class, self.id)
update_user_activity(self.class, self.id)
update_forge_activity(self.class, self.id)
update_org_activity(self.class, self.id)
update_principal_activity(self.class, self.id)
end
def self.create_by_user? user def self.create_by_user? user
if user.anonymous? if user.anonymous?
return false return false

View File

@ -36,6 +36,8 @@ class Message < ActiveRecord::Base
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# 课程动态 # 课程动态
has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy has_many :course_acts, :class_name => 'CourseActivity',:as =>:course_act ,:dependent => :destroy
has_many :user_acts, :class_name => 'UserActivity',:as =>:user_act ,:dependent => :destroy
# end # end
# 课程/项目 消息 # 课程/项目 消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
@ -74,9 +76,9 @@ class Message < ActiveRecord::Base
validates_length_of :subject, :maximum => 255 validates_length_of :subject, :maximum => 255
validate :cannot_reply_to_locked_topic, :on => :create validate :cannot_reply_to_locked_topic, :on => :create
after_create :add_author_as_watcher, :reset_counters! after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
after_update :update_messages_board after_update :update_messages_board, :update_activity
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
#before_save :be_user_score #before_save :be_user_score
@ -125,6 +127,20 @@ class Message < ActiveRecord::Base
end end
end end
# 发帖精辟更新发帖总数
def add_boards_count
if self.project
# 讨论区
if self.parent_id.nil?
count = self.project.boards_count + 1
self.project.update_attribute(:boards_count, count)
else # 回复
count = self.project.boards_reply_count + 1
self.project.update_attribute(:boards_reply_count, count)
end
end
end
def reset_counters! def reset_counters!
if parent && parent.id if parent && parent.id
Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id}) Message.update_all({:last_reply_id => parent.children.maximum(:id)}, {:id => parent.id})
@ -180,6 +196,13 @@ class Message < ActiveRecord::Base
def get_notify_is_read() def get_notify_is_read()
return @notify_is_read return @notify_is_read
end end
#动态的更新
def update_activity
update_course_activity(self.class, self.id)
update_user_activity(self.class, self.id)
update_forge_activity(self.class, self.id)
update_org_activity(self.class, self.id)
end
private private
@ -303,6 +326,20 @@ class Message < ActiveRecord::Base
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::MESSAGE
end end
# 删除帖子的时候更新帖子总数, 删除回复的时候总数不减少
def decrease_boards_count
if self.project && self.parent_id.nil?
# 讨论区
if self.parent_id.nil?
count = self.project.boards_count - 1
self.project.update_attribute(:boards_count, count)
else # 回复
count = self.project.boards_reply_count - 1
self.project.update_attribute(:boards_reply_count, count)
end
end
end
# 课程成员得分(英雄榜) # 课程成员得分(英雄榜)
def act_as_student_score def act_as_student_score
if self.course if self.course

View File

@ -55,9 +55,9 @@ class News < ActiveRecord::Base
:author_key => :author_id :author_key => :author_id
acts_as_watchable acts_as_watchable
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count
after_update :update_activity
after_destroy :delete_kindeditor_assets after_destroy :delete_kindeditor_assets, :decrease_news_count
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
@ -68,6 +68,14 @@ class News < ActiveRecord::Base
} }
safe_attributes 'title', 'summary', 'description', 'sticky' safe_attributes 'title', 'summary', 'description', 'sticky'
#动态的更新
def update_activity
update_course_activity(self.class, self.id)
update_user_activity(self.class, self.id)
update_org_activity(self.class, self.id)
update_forge_activity(self.class, self.id)
end
def visible?(user=User.current) def visible?(user=User.current)
!user.nil? && user.allowed_to?(:view_news, project) !user.nil? && user.allowed_to?(:view_news, project)
end end
@ -107,10 +115,17 @@ class News < ActiveRecord::Base
end end
private private
def add_news_count
if self.project
count = self.project.news_count + 1
self.project.update_attribute(:news_count, count)
end
end
def add_author_as_watcher def add_author_as_watcher
Watcher.create(:watchable => self, :user => author) Watcher.create(:watchable => self, :user => author)
end end
## fq ## fq
def act_as_activity def act_as_activity
self.acts << Activity.new(:user_id => self.author_id) self.acts << Activity.new(:user_id => self.author_id)
@ -161,6 +176,13 @@ class News < ActiveRecord::Base
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::NEWS delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::NEWS
end end
def decrease_news_count
if self.project
count = self.project.news_count - 1
self.project.update_attribute(:news_count, count)
end
end
def send_mail def send_mail
Mailer.run.news_added(self) if Setting.notified_events.include?('news_added') Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
end end

View File

@ -8,6 +8,16 @@ class OrgDocumentComment < ActiveRecord::Base
acts_as_attachable acts_as_attachable
has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy has_many :org_acts, :class_name => 'OrgActivity',:as =>:org_act ,:dependent => :destroy
after_create :document_save_as_org_activity after_create :document_save_as_org_activity
after_update :update_activity
#动态的更新
def update_activity
org_activity = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", id).first
if org_activity
org_activity.updated_at = Time.now
org_activity.save
end
end
def document_save_as_org_activity def document_save_as_org_activity
if(self.parent().nil?) if(self.parent().nil?)

View File

@ -14,7 +14,7 @@ class Poll < ActiveRecord::Base
# 课程消息 # 课程消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
after_save :act_as_course_message, :act_as_activity, :act_as_course_activity after_save :act_as_course_message, :act_as_activity, :act_as_course_activity
after_update :update_activity
acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" }, acts_as_event :title => Proc.new {|o| "#{l(:label_course_poll)}: #{o.polls_name}" },
:description => :polls_description, :description => :polls_description,
:datetime => :published_at, :datetime => :published_at,
@ -32,6 +32,13 @@ class Poll < ActiveRecord::Base
self.acts << Activity.new(:user_id => self.user_id) self.acts << Activity.new(:user_id => self.user_id)
end end
#动态的更新
def update_activity
update_course_activity(self.class, self.id)
update_user_activity(self.class, self.id)
update_org_activity(self.class, self.id)
end
#课程动态公共表记录 #课程动态公共表记录
def act_as_course_activity def act_as_course_activity
if self.polls_type == "Course" if self.polls_type == "Course"

View File

@ -155,7 +155,7 @@ class Project < ActiveRecord::Base
# 创建project之后默认创建一个board之后的board去掉了board的概念 # 创建project之后默认创建一个board之后的board去掉了board的概念
after_create :create_board_sync,:acts_as_forge_activities,:create_project_ealasticsearch_index after_create :create_board_sync,:acts_as_forge_activities,:create_project_ealasticsearch_index
before_destroy :delete_all_members,:delete_project_ealasticsearch_index before_destroy :delete_all_members,:delete_project_ealasticsearch_index
after_update :update_project_ealasticsearch_index # after_update :update_project_ealasticsearch_index
def remove_references_before_destroy def remove_references_before_destroy
return if self.id.nil? return if self.id.nil?
Watcher.delete_all ['watchable_id = ?', id] Watcher.delete_all ['watchable_id = ?', id]
@ -1223,21 +1223,21 @@ class Project < ActiveRecord::Base
self.__elasticsearch__.index_document self.__elasticsearch__.index_document
end end
end end
def update_project_ealasticsearch_index # def update_project_ealasticsearch_index
if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性 # if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
begin # begin
self.__elasticsearch__.update_document # self.__elasticsearch__.update_document
rescue => e # rescue => e
self.__elasticsearch__.index_document # self.__elasticsearch__.index_document
end # end
else #如果是更新成为私有的,那么索引就要被删除 # else #如果是更新成为私有的,那么索引就要被删除
begin # begin
self.__elasticsearch__.delete_document # self.__elasticsearch__.delete_document
rescue => e # rescue => e
#
end # end
end # end
end # end
def delete_project_ealasticsearch_index def delete_project_ealasticsearch_index
begin begin
self.__elasticsearch__.delete_document self.__elasticsearch__.delete_document

View File

@ -409,7 +409,7 @@ class User < Principal
def get_at_show_name def get_at_show_name
name = show_name name = show_name
name = "#{name} #{self.login}" if name != self.login (name != self.login) ? "#{name} #{self.login}" : name
end end
#added by nie #added by nie

View File

@ -74,9 +74,13 @@
<span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发帖时间:<%= format_time(activity.created_on) %> 发帖时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>

View File

@ -40,7 +40,7 @@
} }
$(function () { $(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%"); init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
}); });
</script> </script>
<% if topic %> <% if topic %>

View File

@ -20,7 +20,7 @@
</span> </span>
</div> </div>
<div class="mt5"> <div class="mt5">
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(file.created_on)%></span> <span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
<% if file.tag_list.length > 0%> <% if file.tag_list.length > 0%>
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span> <span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
<% end %> <% end %>

View File

@ -19,7 +19,7 @@
</span> </span>
</div> </div>
<div class="mt5"> <div class="mt5">
<span class="fontGrey2 mr15 fl">上传时间:<%= format_date(file.created_on)%></span> <span class="fontGrey2 mr15 fl">上传时间:<%= format_time(file.created_on)%></span>
<% if file.tag_list.length > 0%> <% if file.tag_list.length > 0%>
<span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span> <span class="fontGrey2 fl mr15">上传类型:<%= file.tag_list[0] %></span>
<% end %> <% end %>

View File

@ -24,14 +24,5 @@
<%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %> <%= render :partial => 'users/project_issue', :locals => {:activity => issue, :user_activity_id => issue.id} %>
<% end %> <% end %>
<% if issues.count == 10%> <% if issues.count == 10%>
<div id="show_more_issues" class="loadMore mt10 f_grey">展开更多<%=link_to "", project_issues_path({:project_id => project.id}.merge(params)),:id => "more_issues_link",:remote => "true",:class => "none" %></div> <%= link_to "点击展开更多",project_issues_path({:project_id => project.id}.merge(params)),:id => "show_more_issues",:remote => "true",:class => "loadMore mt10 f_grey"%>
<%#= link_to "点击展开更多",user_activities_path(@user.id,:type => type,:page => page),:id => "show_more_activities",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end%> <% end%>
<!--<ul class="wlist">-->
<!--<%#= pagination_links_full issue_pages, issue_count, :per_page_links => false, :remote => true, :flag => true %>-->
<!--</ul>-->
<script type="text/javascript">
$("#show_more_issues").mouseover(function(){
$("#more_issues_link").click();
});
</script>

View File

@ -76,9 +76,10 @@
<div class="cl"></div> <div class="cl"></div>
<div> <div>
<% if @project.project_type == 0 %> <% if @project.project_type == 0 %>
<% unless project_scores(@project) == 0 %> <% unless static_project_score(@project) == 0 %>
<span class="fb f14 "><%= l(:label_project_score)%> :</span> <span class="fb f14 "><%= l(:label_project_score)%> :</span>
<%= link_to(format("%.2f" ,project_scores(@project) ).to_i, {:controller => 'projects', <%= link_to(format("%.2f" ,static_project_score(@project) ).to_i,
{:controller => 'projects',
:action => 'show_projects_score', :action => 'show_projects_score',
:remote => true, :remote => true,
:id => @project.id}, :class => "c_orange f14" ) %> :id => @project.id}, :class => "c_orange f14" ) %>
@ -91,12 +92,11 @@
<%= l(:label_member) %><%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue', :id => 'project_members_number' %> <%= l(:label_member) %><%= link_to "#{@project.members.count}", project_member_path(@project), :class => 'info_foot_num c_blue', :id => 'project_members_number' %>
<span>|&nbsp;</span> <span>|&nbsp;</span>
<%= l(:label_user_watcher) %><%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %> <%= l(:label_user_watcher) %><%= link_to "#{@project.watcher_users.count}", {:controller=>"projects", :action=>"watcherlist", :id => @project.id}, :class => 'info_foot_num c_blue' %>
<% attaments_num = @project.attachments.count %>
<% unless @project.enabled_modules.where("name = 'files'").empty? %> <% unless @project.enabled_modules.where("name = 'files'").empty? %>
<span>|&nbsp;</span> <span>|&nbsp;</span>
<%= l(:project_module_attachments) %> <%= l(:project_module_attachments) %>
<% attaments_num %> <% @project.attachments_count %>
<%= link_to "#{attaments_num}", project_files_path(@project), :class => 'info_foot_num c_blue', :id=>'project_files_count_info' %></span> <%= link_to "#{@project.attachments_count}", project_files_path(@project), :class => 'info_foot_num c_blue', :id=>'project_files_count_info' %></span>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
@ -120,11 +120,11 @@
<div id="project_memu_list"> <div id="project_memu_list">
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %> <% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
<%= render :partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num} %> <%= render :partial => 'projects/development_group', :locals => {:project => @project} %>
<% elsif @project.project_new_type == 2 %> <% elsif @project.project_new_type == 2 %>
<%= render :partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num} %> <%= render :partial => 'projects/research_team', :locals => {:project => @project} %>
<% else %> <% else %>
<%= render :partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num} %> <%= render :partial => 'projects/friend_group', :locals => {:project => @project} %>
<% end %> <% end %>
</div> </div>
@ -213,19 +213,19 @@
if(data == 1) if(data == 1)
{ {
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>"); $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_development_team), 1))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>'); $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/development_group', :locals => {:project => @project})) %>');
$("#close_light").attr("onClick","close_window('development_group');"); $("#close_light").attr("onClick","close_window('development_group');");
} }
else if(data == 2) else if(data == 2)
{ {
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>"); $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_research_group), 2))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team', :locals => {:project => @project, :attaments_num => attaments_num})) %>'); $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/research_team', :locals => {:project => @project})) %>');
$("#close_light").attr("onClick","close_window('research_group');"); $("#close_light").attr("onClick","close_window('research_group');");
} }
else if(data == 3) else if(data == 3)
{ {
$("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>"); $("#setting_project_type").replaceWith("<%= escape_javascript(project_type_link(l(:label_friend_organization), 3))%>");
$("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group', :locals => {:project => @project, :attaments_num => attaments_num})) %>'); $("#project_memu_list").html('<%= escape_javascript(render(:partial => 'projects/friend_group', :locals => {:project => @project})) %>');
$("#close_light").attr("onClick","close_window('friend_organization');"); $("#close_light").attr("onClick","close_window('friend_organization');");
} }
else else

View File

@ -17,9 +17,13 @@
<div class="homepagePostTitle break_word" > <div class="homepagePostTitle break_word" >
<%= link_to activity.name, course_path(activity.id,:host=>Setting.host_course), :class => "postGrey" %> <%= link_to activity.name, course_path(activity.id,:host=>Setting.host_course), :class => "postGrey" %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
创建时间:<%= format_time(activity.created_at) %> 创建时间:<%= format_time(activity.created_at) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">

View File

@ -28,9 +28,13 @@
<span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发帖时间:<%= format_time(activity.created_on) %> 发帖时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>

View File

@ -20,9 +20,13 @@
<span class="sticky_btn_cir ml10">置顶</span> <span class="sticky_btn_cir ml10">置顶</span>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发布时间:<%= format_time(activity.created_on) %> 发布时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<%= activity.description.html_safe %> <%= activity.description.html_safe %>

View File

@ -27,9 +27,13 @@
<%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%> <%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发布时间:<%= format_time(activity.published_at) %> 发布时间:<%= format_time(activity.published_at) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<%= activity.polls_description.html_safe %> <%= activity.polls_description.html_safe %>

View File

@ -29,10 +29,14 @@
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDeadline"> <div class="homepagePostDeadline fl">
时间: 发布时间:
<%=format_time(activity.created_on) %> <%=format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
</div> </div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">

View File

@ -24,9 +24,13 @@
%> %>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
时间:<%= format_time(activity.created_on) %> 发布时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(OrgActivity.where("org_act_type='#{activity.class}' and org_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>

View File

@ -19,9 +19,13 @@
<div class="homepagePostTitle break_word" > <div class="homepagePostTitle break_word" >
<%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
创建时间:<%= format_time(project.created_on) %> 创建时间:<%= format_time(project.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">

View File

@ -24,9 +24,13 @@
%> %>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
时间:<%= format_time(activity.created_on) %> 发帖时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>

View File

@ -12,8 +12,13 @@
<span style="color:#269ac9;"><%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %></span> <span style="color:#269ac9;"><%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %></span>
</div> </div>
<div class="homepagePostTitle postGrey"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></div> <div class="homepagePostTitle postGrey"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %></div> 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
</div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(OrgActivity.where("org_act_type='#{document.class}' and org_act_id =#{document.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<% unless document.content.blank? %> <% unless document.content.blank? %>
<div class="homepagePostIntro" style="width:640px;"> <div class="homepagePostIntro" style="width:640px;">
<%= document.content.html_safe %> <%= document.content.html_safe %>

View File

@ -1,14 +1,14 @@
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %> <%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %> <% unless @project.acts_count == 0 %>
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a> <a class="subnav_num">(<%= @project.acts_count %>)</a>
<% end %> <% end %>
</div> </div>
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:label_issue_tracking), project_issues_path(@project, :remote => true), :class => "f14 c_blue02" %>
<% if (issue_count = @project.issues.count) > 0 %> <% if @project.issues_count > 0 %>
<a class="subnav_num">(<%= issue_count %>)</a> <a class="subnav_num">(<%= @project.issues_count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
@ -19,8 +19,8 @@
<% unless @project.enabled_modules.where("name = 'boards'").empty? %> <% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
<% unless @project.boards.first.topics.count == 0 %> <% unless @project.boards_count == 0 %>
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a> <a class="subnav_num">(<%= @project.boards_count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
@ -30,8 +30,8 @@
<% unless @project.enabled_modules.where("name = 'files'").empty? %> <% unless @project.enabled_modules.where("name = 'files'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %> <% unless @project.attachments_count == 0 %>
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> <%= link_to "(#{@project.attachments_count})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%#= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %> <%#= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>

View File

@ -1,14 +1,14 @@
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %> <%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %> <% unless @project.acts_count == 0 %>
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a> <a class="subnav_num">(<%= @project.acts_count %>)</a>
<% end %> <% end %>
</div> </div>
<% unless @project.enabled_modules.where("name = 'boards'").empty? %> <% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
<% unless @project.boards.first.topics.count == 0 %> <% unless @project.boards_count == 0 %>
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a> <a class="subnav_num">(<%= @project.boards_count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
@ -18,8 +18,8 @@
<% unless @project.enabled_modules.where("name = 'files'").empty? %> <% unless @project.enabled_modules.where("name = 'files'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %> <% unless @project.attachments_count == 0 %>
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> <%= link_to "(#{@project.attachments_count})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %> <%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>

View File

@ -19,9 +19,13 @@
<span class="sticky_btn_cir ml10">置顶</span> <span class="sticky_btn_cir ml10">置顶</span>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发布时间:<%= format_time(activity.created_on) %> 发布时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id %>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id %>">
<div id="intro_content_<%= user_activity_id %>"> <div id="intro_content_<%= user_activity_id %>">
<%= activity.description.html_safe %> <%= activity.description.html_safe %>

View File

@ -1,10 +1,9 @@
<!-- added by bai -->
<div style="color: #64BDD9;font-size: 14px;font-weight: bold"><%= l(:label_projects_score) %></div> <div style="color: #64BDD9;font-size: 14px;font-weight: bold"><%= l(:label_projects_score) %></div>
<div> = <%= l(:label_issue_score) %> + <%= l(:label_news_score) %> + <%= l(:label_file_score) %> + <div> = <%= l(:label_code_submit_score) %> + <%= l(:label_issue_score) %> + <%= l(:label_file_attachment_score) %> + <%= l(:label_topic_score) %> + <%= l(:label_news_score) %></div>
<%= l(:label_code_submit_score) %> + <%= l(:label_topic_score) %></div> <div> = <%= @project.commits_count * 4 %> +
<div> = <%= format("%.2f" , issue_score(project)).to_i %> + <%= format("%.2f" , news_score(project)).to_i %> + <%= @project.issues_count * 4 + @project.journals_count %> +
<%= format("%.2f" , documents_score(project)).to_i %> + <%= format("%.2f" , changesets_score(project)).to_i %> + <%= @project.attachments_count * 5 %> +
<%= format("%.2f" , board_message_score(project)).to_i %></div> <%= @project.boards_count * 2 + @project.boards_reply_count %> +
<div> = <%= format("%.2f" , project_scores(project)).to_i %></div> <%= @project.news_count %>
<!-- end --> </div>
<div> = <%= static_project_score(@project) %></div>

View File

@ -1,14 +1,14 @@
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %> <%= link_to l(:label_activity), {:controller => 'projects', :action => 'show', :id => @project.id}, :class => "f14 c_blue02" %>
<% unless ForgeActivity.where("project_id = ?", @project.id).count == 0 %> <% unless @project.acts_count == 0 %>
<a class="subnav_num">(<%= ForgeActivity.where("project_id = ?", @project.id).count %>)</a> <a class="subnav_num">(<%= @project.acts_count %>)</a>
<% end %> <% end %>
</div> </div>
<% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %> <% unless @project.enabled_modules.where("name = 'issue_tracking'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:label_issue_tracking), project_issues_path(@project), :class => "f14 c_blue02" %>
<% if (issue_count = @project.issues.count) > 0 %> <% if @project.issues_count > 0 %>
<a class="subnav_num">(<%= issue_count %>)</a> <a class="subnav_num">(<%= @project.issues_count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %> <%= link_to "+"+l(:label_release_issue), new_project_issue_path(@project) , :class => "subnav_green" %>
@ -18,8 +18,8 @@
<% unless @project.enabled_modules.where("name = 'boards'").empty? %> <% unless @project.enabled_modules.where("name = 'boards'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:project_module_boards), project_boards_path(@project), :class => "f14 c_blue02" %>
<% unless @project.boards.first.topics.count == 0 %> <% unless @project.boards_count == 0 %>
<a class="subnav_num">(<%= @project.boards.first.topics.count %>)</a> <a class="subnav_num">(<%= @project.boards_count %>)</a>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %> <%= link_to "+"+l(:project_module_boards_post), project_boards_path(@project, :flag => true), :layout => 'base_projects', :class => "subnav_green ml105" %>
@ -29,8 +29,8 @@
<% unless @project.enabled_modules.where("name = 'files'").empty? %> <% unless @project.enabled_modules.where("name = 'files'").empty? %>
<div class="subNav"> <div class="subNav">
<%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %> <%= link_to l(:project_module_files), project_files_path(@project), :class => "f14 c_blue02" %>
<% unless attaments_num == 0 %> <% unless @project.attachments_count == 0 %>
<%= link_to "(#{attaments_num})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %> <%= link_to "(#{@project.attachments_count})", project_files_path(@project), :class => "subnav_num c_orange",:id=>'project_files_count_nav' %>
<% end %> <% end %>
<% if User.current.member_of?(@project) %> <% if User.current.member_of?(@project) %>
<%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %> <%= link_to "+"+l(:label_upload_source), project_files_path(@project,:flag => true), :class => "subnav_green ml95" %>

View File

@ -1,5 +1,3 @@
<!-- added by bai -->
<h3 class="title"><%= l(:label_projects_score) %></h3> <h3 class="title"><%= l(:label_projects_score) %></h3>
<div class="inf_user_image"> <div class="inf_user_image">
<table style="border-bottom: solid 1px #80a6d2;" width="100%"> <table style="border-bottom: solid 1px #80a6d2;" width="100%">
@ -14,72 +12,35 @@
<td width="35%"> <td width="35%">
<table> <table>
<tr class="info_font" style="color: #64BDD9;font-size: 14px;font-weight: bold"><td><%= l(:label_projects_score) %></td></tr> <tr class="info_font" style="color: #64BDD9;font-size: 14px;font-weight: bold"><td><%= l(:label_projects_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , project_scores(@project) ).to_i %></span></td></tr> <tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= static_project_score(@project) %></span></td></tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<script type="text/javascript">
function show_div(url)
{
if(url == 'project_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/project_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'issue_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/issue_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'news_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/news_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'file_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/file_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'code_submit_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/code_submit_score_index', :locals => {:project => @project}) %>');
}
else if(url == 'projects_topic_score_index')
{
$('#show_score_detail').html('<%= escape_javascript(render :partial => 'projects/projects_topic_score_index', :locals => {:project => @project}) %>');
}
}
</script>
<div class="tabs_new"> <div class="tabs_new">
<ul> <ul>
<li> <li>
<%= link_to l(:label_projects_score),"javascript:void(0)", :onclick => "show_div('project_score_index')"%> : <%= link_to l(:label_projects_score),"javascript:void(0)", :onclick => "show_div('project_score_index')"%> : <%= static_project_score(@project) %>
<%= format("%.2f" , project_scores(@project) ).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= link_to l(:label_code_submit_score), "javascript:void(0)", :onclick => "show_div('code_submit_score_index')" %> : <%= @project.commits_count * 4 %>
<%= format("%.2f" , issue_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_news_score), "javascript:void(0)", :onclick => "show_div('news_score_index')"%> : <%= link_to l(:label_issue_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.issues_count * 4 + @project.journals_count %>
<%= format("%.2f" , news_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_file_score), "javascript:void(0)", :onclick => "show_div('file_score_index')"%> : <%= link_to l(:label_file_attachment_score), "javascript:void(0)", :onclick => "show_div('issue_score_index')"%> : <%= @project.attachments_count * 5 %>
<%= format("%.2f" , documents_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_code_submit_score), "javascript:void(0)", :onclick => "show_div('code_submit_score_index')" %> : <%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> : <%= @project.boards_count * 2 + @project.boards_reply_count %>
<%= format("%.2f" , changesets_score(@project)).to_i %>
</li> </li>
<li> <li>
<%= link_to l(:label_topic_score), "javascript:void(0)", :onclick => "show_div('projects_topic_score_index')"%> : <%= link_to l(:label_news_score), "javascript:void(0)", :onclick => "show_div('news_score_index')"%> : <%= @project.news_count %>
<%= format("%.2f" , board_message_score(@project)).to_i %>
</li> </li>
</ul> </ul>
</div> </div>
<div id="show_score_detail"> <div id="show_score_detail">
<%= render :partial => 'projects/project_score_index', :locals => {:project => @project } %> <%= render :partial => 'projects/project_score_index', :locals => {:project => @project } %>
</div> </div>
<!-- end -->

View File

@ -17,9 +17,13 @@
<div class="homepagePostTitle break_word" > <div class="homepagePostTitle break_word" >
<%= link_to activity.name, course_path(activity.id,:host=>Setting.host_course), :class => "postGrey" %> <%= link_to activity.name, course_path(activity.id,:host=>Setting.host_course), :class => "postGrey" %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
创建时间:<%= format_time(activity.created_at) %> 创建时间:<%= format_time(activity.created_at) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">

View File

@ -20,9 +20,13 @@
<%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %> <%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
留言时间:<%= format_time(activity.created_on) %> 留言时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -28,9 +28,13 @@
<span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> <span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发帖时间:<%= format_time(activity.created_on) %> 发帖时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>

View File

@ -20,9 +20,13 @@
<span class="sticky_btn_cir ml10">置顶</span> <span class="sticky_btn_cir ml10">置顶</span>
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发布时间:<%= format_time(activity.created_on) %> 发布时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<%= activity.description.html_safe %> <%= activity.description.html_safe %>

View File

@ -27,9 +27,13 @@
<%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%> <%= link_to poll_name, poll_path(activity.id), :class => "postGrey"%>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发布时间:<%= format_time(activity.published_at) %> 发布时间:<%= format_time(activity.published_at) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<%= activity.polls_description.html_safe %> <%= activity.polls_description.html_safe %>

View File

@ -19,9 +19,13 @@
<div class="homepagePostTitle break_word" > <div class="homepagePostTitle break_word" >
<%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %> <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
创建时间:<%= format_time(project.created_on) %> 创建时间:<%= format_time(project.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden"> <div class="homepagePostSetting" id="act-<%= user_activity_id %>" style="visibility: hidden">
<ul> <ul>
<li class="homepagePostSettingIcon"> <li class="homepagePostSettingIcon">

View File

@ -41,10 +41,14 @@
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDeadline"> <div class="homepagePostDeadline fl">
时间: 发布时间:
<%=format_time(activity.created_on) %> <%=format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
</div> </div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">

View File

@ -29,9 +29,13 @@
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发帖时间:<%= format_time(activity.created_on) %> 发帖时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<% if activity.parent_id.nil? %> <% if activity.parent_id.nil? %>

View File

@ -26,9 +26,13 @@
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
发布时间:<%= format_time(activity.created_on) %> 发布时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>"> <div class="homepagePostIntro break_word upload_img list_style maxh360 table_maxWidth" id="activity_description_<%= user_activity_id%>">
<div id="intro_content_<%= user_activity_id%>"> <div id="intro_content_<%= user_activity_id%>">
<%= activity.content.html_safe %> <%= activity.content.html_safe %>

View File

@ -42,9 +42,9 @@
<% if homework_commons.count == 10%> <% if homework_commons.count == 10%>
<% if is_in_course == 1%> <% if is_in_course == 1%>
<!-- 在课程内 --> <!-- 在课程内 -->
<%= link_to "加载更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> <%= link_to "点击展开更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% else%> <% else%>
<!-- 在个人主页 --> <!-- 在个人主页 -->
<%= link_to "加载更多",user_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%> <%= link_to "点击展开更多",user_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
<% end%> <% end%>
<% end%> <% end%>

View File

@ -23,9 +23,13 @@
<%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %> <%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
<% end %> <% end %>
</div> </div>
<div class="homepagePostDate"> <div class="homepagePostDate fl">
留言时间:<%= format_time(activity.created_on) %> 留言时间:<%= format_time(activity.created_on) %>
</div> </div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
</div>
<div class="cl"></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -433,6 +433,8 @@ zh:
label_file_score: 文档得分 label_file_score: 文档得分
label_file_number: 文档的数量 label_file_number: 文档的数量
label_file_attachment_score: 资源得分
label_code_submit_score: 代码提交得分 label_code_submit_score: 代码提交得分
label_code_submit_number: 代码提交频率 label_code_submit_number: 代码提交频率

View File

@ -0,0 +1,5 @@
class AddIssuesCountToProject < ActiveRecord::Migration
def change
add_column :projects, :issues_count, :integer, :default => false
end
end

View File

@ -0,0 +1,5 @@
class AddAttachmentsCountToProject < ActiveRecord::Migration
def change
add_column :projects, :attachments_count, :integer, :default => false
end
end

View File

@ -0,0 +1,5 @@
class AddBoardsCountToProject < ActiveRecord::Migration
def change
add_column :projects, :boards_count, :integer, :default => false
end
end

View File

@ -0,0 +1,5 @@
class AddNewsCountToProject < ActiveRecord::Migration
def change
add_column :projects, :news_count, :integer, :default => false
end
end

View File

@ -0,0 +1,14 @@
class StaticProjectBoards < ActiveRecord::Migration
def up
Project.all.each do |project|
puts project.id
unless project.boards.first.nil?
boards_count = project.boards.first.topics.count
project.update_attribute(:boards_count, boards_count)
end
end
end
def down
end
end

View File

@ -0,0 +1,13 @@
class StaticProjectIssues < ActiveRecord::Migration
def up
Project.all.each do |project|
unless project.issues.nil?
issues_count = project.issues.count
project.update_attribute(:issues_count, issues_count)
end
end
end
def down
end
end

View File

@ -0,0 +1,13 @@
class StaticProjectNews < ActiveRecord::Migration
def up
Project.all.each do |project|
unless project.news.nil?
news_count = project.news.count
project.update_attribute(:news_count, news_count)
end
end
end
def down
end
end

View File

@ -0,0 +1,13 @@
class StaticProjectAttachments < ActiveRecord::Migration
def up
Project.all.each do |project|
unless project.attachments.nil?
attachments_count = project.attachments.count
project.update_attribute(:attachments_count, attachments_count)
end
end
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddActsCountToProject < ActiveRecord::Migration
def change
add_column :projects, :acts_count, :integer, :default => false
end
end

View File

@ -0,0 +1,16 @@
class StaticProjectActs < ActiveRecord::Migration
def up
Project.all.each do |project|
acts = ForgeActivity.where("project_id = ?", project.id)
unless acts.blank?
count = acts.count
puts project.id
puts "acts_count is #{count}"
project.update_attribute(:acts_count, count)
end
end
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddJournalsCountToProject < ActiveRecord::Migration
def change
add_column :projects, :journals_count, :integer, :default => false
end
end

View File

@ -0,0 +1,12 @@
class StaticsIssueJournal < ActiveRecord::Migration
def up
Project.all.each do |project|
if !project.project_score.nil? && !project.project_score.issue_journal_num.nil?
project.update_attribute(:journals_count, project.project_score.issue_journal_num)
end
end
end
def down
end
end

View File

@ -0,0 +1,19 @@
class StaticsRepositoryCommits < ActiveRecord::Migration
def up
g = Gitlab.client
Project.all.each do |project|
unless project.gpid.nil?
begin
puts project.id
count = g.project(project.gpid).commit_count
rescue
logger.error("The project's rep is not exit!")
end
project.update_attribute(:commits_count, count)
end
end
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddMessagesCountToProject < ActiveRecord::Migration
def change
add_column :projects, :boards_reply_count, :integer, :default => false
end
end

View File

@ -0,0 +1,14 @@
class StaticsBoardsReply < ActiveRecord::Migration
def up
Project.all.each do |project|
puts project.id
unless project.boards.first.nil?
messages_count = Message.where("board_id =? and parent_id is not ?", project.boards.first.id, nil).count
project.update_attribute(:boards_reply_count, messages_count)
end
end
end
def down
end
end

View File

@ -23,7 +23,7 @@ var enableAt = function(_editor) {
} }
if('undefined' != (typeof id)){ if('undefined' != (typeof id)){
names = '/at/' + id + '?type='+type; names = '/at/' + id + '.json?type='+type;
} }
//var names = ["Jacob","Isabella","Ethan","Emma","Michael","Olivia","Alexander","Sophia","William","Ava","Joshua","Emily","Daniel","Madison","Jayden","Abigail","Noah","Chloe","你好","你你你", "가"]; //var names = ["Jacob","Isabella","Ethan","Emma","Michael","Olivia","Alexander","Sophia","William","Ava","Joshua","Emily","Daniel","Madison","Jayden","Abigail","Noah","Chloe","你好","你你你", "가"];

View File

@ -158,7 +158,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.w583{ width:583px;} .w583{ width:583px;}
.w350{ width:350px;} .w350{ width:350px;}
.w610{ width:610px;} .w610{ width:610px;}
.w60{ width:600px !important;} .w600{ width:600px !important;}
.w606{ width:606px } .w606{ width:606px }
.h20{height: 20px;} .h20{height: 20px;}
.h22{ height:22px;} .h22{ height:22px;}
@ -397,7 +397,7 @@ li.menuArrow:hover {background:url(../images/item.png) -20px -70px no-repeat;}
a.topnav_login_box:hover {color:#a1ebff;} a.topnav_login_box:hover {color:#a1ebff;}
.navRow1 {margin:0; padding:0;} .navRow1 {margin:0; padding:0;}
.navRow2 {margin:0; padding:0;} .navRow2 {margin:0; padding:0;}
.topnav_login_list{ border:1px solid #269ac9; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;} .topnav_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;}
.topnav_login_list a{color:#15bccf;} .topnav_login_list a{color:#15bccf;}
.topnav_login_list li{ } .topnav_login_list li{ }

View File

@ -52,6 +52,7 @@ table.filecontent th.line-num {
-ms-user-select: none; -ms-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
font-weight:normal; font-weight:normal;
white-space: nowrap;
} }
table.filecontent th.line-num a { table.filecontent th.line-num a {
text-decoration: none; text-decoration: none;