Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
e8c5627c41
3
Gemfile
3
Gemfile
|
@ -42,6 +42,9 @@ group :development, :test do
|
|||
gem 'pry-byebug'
|
||||
end
|
||||
gem 'pry-stack_explorer'
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem 'puma'
|
||||
end
|
||||
end
|
||||
|
||||
gem 'rspec-rails', '~> 3.0'
|
||||
|
|
|
@ -386,6 +386,7 @@ class IssuesController < ApplicationController
|
|||
end
|
||||
|
||||
def add_journal
|
||||
if User.current.logged?
|
||||
jour = Journal.new
|
||||
jour.user_id = User.current.id
|
||||
jour.notes = params[:notes]
|
||||
|
@ -396,6 +397,7 @@ class IssuesController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -101,27 +101,27 @@ class MessagesController < ApplicationController
|
|||
ids = params[:asset_id].split(',')
|
||||
update_kindeditor_assets_owner ids,@message.id,OwnerTypeHelper::MESSAGE
|
||||
end
|
||||
# 与我相关动态的记录add start
|
||||
if(@board && @board.course) #项目的先不管
|
||||
teachers = searchTeacherAndAssistant(@board.course)
|
||||
for teacher in teachers
|
||||
if(teacher.user_id != User.current.id)
|
||||
notify = ActivityNotify.new()
|
||||
if(@board.course)
|
||||
notify.activity_container_id = @board.course_id
|
||||
notify.activity_container_type = 'Course'
|
||||
else
|
||||
notify.activity_container_id = @board.project_id
|
||||
notify.activity_container_type = 'Project'
|
||||
end
|
||||
notify.activity_id = @message.id
|
||||
notify.activity_type = 'Message'
|
||||
notify.notify_to = teacher.user_id
|
||||
notify.is_read = 0
|
||||
notify.save()
|
||||
end
|
||||
end
|
||||
end
|
||||
# # 与我相关动态的记录add start
|
||||
# if(@board && @board.course) #项目的先不管
|
||||
# teachers = searchTeacherAndAssistant(@board.course)
|
||||
# for teacher in teachers
|
||||
# if(teacher.user_id != User.current.id)
|
||||
# notify = ActivityNotify.new()
|
||||
# if(@board.course)
|
||||
# notify.activity_container_id = @board.course_id
|
||||
# notify.activity_container_type = 'Course'
|
||||
# else
|
||||
# notify.activity_container_id = @board.project_id
|
||||
# notify.activity_container_type = 'Project'
|
||||
# end
|
||||
# notify.activity_id = @message.id
|
||||
# notify.activity_type = 'Message'
|
||||
# notify.notify_to = teacher.user_id
|
||||
# notify.is_read = 0
|
||||
# notify.save()
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# 与我相关动态的记录add end
|
||||
|
||||
call_hook(:controller_messages_new_after_save, { :params => params, :message => @message})
|
||||
|
|
|
@ -102,22 +102,22 @@ class UsersController < ApplicationController
|
|||
# issue:问题;journal:缺陷状态更新; forum:公共贴吧: user_feedback: 用户留言; new_reply:新闻回复(comment)
|
||||
def user_messages
|
||||
unless User.current.logged?
|
||||
render_403
|
||||
redirect_to signin_url
|
||||
return
|
||||
end
|
||||
# 当前用户查看消息,则设置消息为已读
|
||||
#if params[:viewed] == "all"
|
||||
# course_querys = @user.course_messages
|
||||
# forge_querys = @user.forge_messages
|
||||
# user_querys = @user.user_feedback_messages
|
||||
# forum_querys = @user.memo_messages
|
||||
# if User.current.id == @user.id
|
||||
# course_querys.update_all(:viewed => true)
|
||||
# forge_querys.update_all(:viewed => true)
|
||||
# user_querys.update_all(:viewed => true)
|
||||
# forum_querys.update_all(:viewed => true)
|
||||
# end
|
||||
#end
|
||||
if params[:viewed] == "all"
|
||||
course_querys = @user.course_messages
|
||||
forge_querys = @user.forge_messages
|
||||
user_querys = @user.user_feedback_messages
|
||||
forum_querys = @user.memo_messages
|
||||
if User.current.id == @user.id
|
||||
course_querys.update_all(:viewed => true)
|
||||
forge_querys.update_all(:viewed => true)
|
||||
user_querys.update_all(:viewed => true)
|
||||
forum_querys.update_all(:viewed => true)
|
||||
end
|
||||
end
|
||||
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
|
||||
case params[:type]
|
||||
when nil
|
||||
|
@ -296,6 +296,7 @@ class UsersController < ApplicationController
|
|||
|
||||
#用户作业列表
|
||||
def user_homeworks
|
||||
if User.current == @user
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_course_ids = "(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
||||
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
|
||||
|
@ -303,6 +304,9 @@ class UsersController < ApplicationController
|
|||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
#导入作业
|
||||
|
@ -345,6 +349,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def new_user_commit_homework
|
||||
if User.current.logged?
|
||||
@user = User.current
|
||||
@homework = HomeworkCommon.find(params[:homework_id])
|
||||
@is_test = params[:is_test] == 'true'
|
||||
|
@ -356,6 +361,9 @@ class UsersController < ApplicationController
|
|||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def user_commit_homework
|
||||
|
@ -364,6 +372,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def user_new_homework
|
||||
if User.current.logged?
|
||||
if params[:homework_common]
|
||||
homework = HomeworkCommon.new
|
||||
homework.name = params[:homework_common][:name]
|
||||
|
@ -412,6 +421,9 @@ class UsersController < ApplicationController
|
|||
redirect_to user_homeworks_user_path(User.current.id)
|
||||
end
|
||||
end
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
#用户从资源库导入资源到作业
|
||||
|
@ -541,6 +553,10 @@ class UsersController < ApplicationController
|
|||
|
||||
# modified by fq
|
||||
def user_newfeedback
|
||||
unless User.current.logged?
|
||||
redirect_to signin_url
|
||||
return
|
||||
end
|
||||
# 更新用户留言消息状态
|
||||
@user.journals_for_messages.each do |jour_message|
|
||||
jour_message.user_feedback_messages.each do |userfeedback_message|
|
||||
|
@ -784,11 +800,13 @@ class UsersController < ApplicationController
|
|||
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('created_at desc').limit(10).offset(@page * 10)
|
||||
when "project_message"
|
||||
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('created_at desc').limit(10).offset(@page * 10)
|
||||
when "current_user"
|
||||
@user_activities = UserActivity.where("user_id = #{User.current.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('created_at desc').limit(10).offset(@page * 10)
|
||||
else
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10)
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
|
||||
end
|
||||
else
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids}) and act_type in #{course_types}").order('created_at desc').limit(10).offset(@page * 10)
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('created_at desc').limit(10).offset(@page * 10)
|
||||
end
|
||||
# @user_activities = paginateHelper @user_activities,500
|
||||
@type = params[:type]
|
||||
|
|
|
@ -2334,6 +2334,20 @@ module ApplicationHelper
|
|||
end
|
||||
end
|
||||
end
|
||||
#动态列表中,确定学生是该提交还是进列表
|
||||
def student_work_activity_submit_status(opt={})
|
||||
default_opt = {class: 'c_blue'}.merge(opt)
|
||||
|
||||
is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
|
||||
|
||||
homework = default_opt[:homework]
|
||||
work = cur_user_works_for_homework homework
|
||||
if work.nil? && !is_teacher
|
||||
link_to "提交("+homework.student_works.count.to_s+")", new_student_work_path(:homework => homework.id), :class=> default_opt[:class]
|
||||
else
|
||||
link_to "提交("+homework.student_works.count.to_s+")", student_work_index_path(:homework => homework.id), :class=> default_opt[:class]
|
||||
end
|
||||
end
|
||||
|
||||
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
|
||||
def user_for_homework_common homework,is_teacher
|
||||
|
|
|
@ -423,7 +423,7 @@ module UserScoreHelper
|
|||
|
||||
#更新分数
|
||||
def update_score(option_number)
|
||||
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + active(option_number)
|
||||
option_number.total_score = collaboration(option_number) + influence(option_number) + skill(option_number) + project_active(option_number)
|
||||
if option_number.total_score < 0
|
||||
option_number.total_score = 0
|
||||
end
|
||||
|
@ -433,7 +433,7 @@ module UserScoreHelper
|
|||
|
||||
#协同得分
|
||||
def collaboration(option_number)
|
||||
option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo
|
||||
option_number.memo * 2 + option_number.messages_for_issues + option_number.issues_status + option_number.replay_for_message + option_number.replay_for_memo
|
||||
end
|
||||
#影响力得分
|
||||
def influence(option_number)
|
||||
|
@ -444,8 +444,8 @@ module UserScoreHelper
|
|||
option_number.praise_by_one * 4 + option_number.praise_by_two * 6 + option_number.praise_by_three * 8 - option_number.tread * 2 - option_number.tread_by_one * 2 - option_number.tread_by_two * 4 - option_number.tread_by_three * 6
|
||||
end
|
||||
#项目贡献得分
|
||||
def active(option_number)
|
||||
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4 + option_number.memo * 2
|
||||
def project_active(option_number)
|
||||
option_number.changeset * 4 + option_number.document * 4 + option_number.attachment * 4 + option_number.issue_done_ratio * 2 + option_number.post_issue * 4
|
||||
end
|
||||
|
||||
#更新发帖数
|
||||
|
|
|
@ -19,6 +19,7 @@ class CourseActivity < ActiveRecord::Base
|
|||
user_activity.act_type = self.course_act_type
|
||||
user_activity.container_type = "Course"
|
||||
user_activity.container_id = self.course_id
|
||||
user_activity.user_id = self.user_id
|
||||
user_activity.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,6 +15,8 @@ class CourseMessage < ActiveRecord::Base
|
|||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,6 +22,8 @@ class ForgeMessage < ActiveRecord::Base
|
|||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,8 @@ class MemoMessage < ActiveRecord::Base
|
|||
after_create :add_user_message
|
||||
|
||||
def add_user_message
|
||||
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -121,7 +121,7 @@ class News < ActiveRecord::Base
|
|||
# Description 公用表中也要记录
|
||||
def act_as_forge_activity
|
||||
# 如果是project为空,那么是课程相关的,不需要保存
|
||||
if !self.project.nil?
|
||||
if self.project
|
||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
||||
:project_id => self.project.id)
|
||||
end
|
||||
|
|
|
@ -492,28 +492,29 @@ class Query < ActiveRecord::Base
|
|||
|
||||
def project_statement
|
||||
project_clauses = []
|
||||
unless project.descendants.blank?
|
||||
if project && !project.descendants.active.empty?
|
||||
ids = [project.id]
|
||||
if has_filter?("subproject_id")
|
||||
case operator_for("subproject_id")
|
||||
when '='
|
||||
# include the selected subprojects
|
||||
ids += values_for("subproject_id").each(&:to_i)
|
||||
when '!*'
|
||||
# main project only
|
||||
else
|
||||
# all subprojects
|
||||
ids += project.descendants.collect(&:id)
|
||||
end
|
||||
elsif Setting.display_subprojects_issues?
|
||||
ids += project.descendants.collect(&:id)
|
||||
end
|
||||
project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
|
||||
elsif project
|
||||
# unless project.descendants.blank?
|
||||
# if project && project.descendants && project.descendants.active && !project.descendants.active.empty?
|
||||
# ids = [project.id]
|
||||
# if has_filter?("subproject_id")
|
||||
# case operator_for("subproject_id")
|
||||
# when '='
|
||||
# # include the selected subprojects
|
||||
# ids += values_for("subproject_id").each(&:to_i)
|
||||
# when '!*'
|
||||
# # main project only
|
||||
# else
|
||||
# # all subprojects
|
||||
# ids += project.descendants.collect(&:id)
|
||||
# end
|
||||
# elsif Setting.display_subprojects_issues?
|
||||
# ids += project.descendants.collect(&:id)
|
||||
# end
|
||||
# project_clauses << "#{Project.table_name}.id IN (%s)" % ids.join(',')
|
||||
# elsif project
|
||||
if project
|
||||
project_clauses << "#{Project.table_name}.id = %d" % project.id
|
||||
end
|
||||
end
|
||||
# end
|
||||
project_clauses.any? ? project_clauses.join(' AND ') : nil
|
||||
end
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ class UserFeedbackMessage < ActiveRecord::Base
|
|||
after_save :add_user_message
|
||||
|
||||
def add_user_message
|
||||
if MessageAll.where("message_type = '#{self.class.to_s}' and message_id = '#{self.id}'").first.nil?
|
||||
self.message_alls << MessageAll.new(:user_id => self.user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<%=@count %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=format_date(user.last_login_on) %>
|
||||
<%=format_time(user.last_login_on) %>
|
||||
</td>
|
||||
<td align="center">
|
||||
<%=user.id %>
|
||||
|
|
|
@ -19,12 +19,23 @@
|
|||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
<%= stylesheet_link_tag 'base','header', :media => 'all'%>
|
||||
</head>
|
||||
<body class="<%=h body_css_classes %>">
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="navContainer mb10">
|
||||
<% if User.current.logged? %>
|
||||
<%= render :partial => 'layouts/logined_header',:locals=>{:name=>@name,:type=>@type} %>
|
||||
<% else%>
|
||||
<%= render :partial => 'layouts/unlogin_header',:locals=>{:name=>@name,:type=>@type} %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div id="wrapper">
|
||||
<div id="wrapper2">
|
||||
<div id="wrapper3">
|
||||
<%= render :partial => 'layouts/base_header'%>
|
||||
|
||||
<div id="main" class="">
|
||||
<div id="sidebar">
|
||||
|
@ -38,7 +49,6 @@
|
|||
<%= call_hook :view_layouts_base_content %>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
<%= render :partial => 'layouts/base_footer'%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -47,6 +57,11 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<%= render :partial => 'layouts/footer' %>
|
||||
<div class="cl"></div>
|
||||
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -24,16 +24,24 @@
|
|||
if(email == "")
|
||||
{
|
||||
$("#valid_email").text("<%= l(:label_input_email_blank)%>");
|
||||
return false;
|
||||
}
|
||||
else if (filter.test(email)) {
|
||||
$("#valid_email").html("");
|
||||
return true;
|
||||
else if(!filter.test(email))
|
||||
{
|
||||
$("#valid_email").text("<%= l(:label_email_format_error)%>");
|
||||
return false;
|
||||
}
|
||||
else if(email.split('@')[0].length >= 20)
|
||||
{
|
||||
$("#valid_email").text("邮箱名过长,最长为20个字符");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#valid_email").text("<%= l(:label_email_format_error)%>");
|
||||
$("#valid_email").text("");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
function senderEmail(obj)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
</div>
|
||||
<div class="homepagePostSubmitContainer">
|
||||
<div class="homepagePostSubmit">
|
||||
<%= link_to "提交("+activity.student_works.count.to_s+")", student_work_index_path(:homework => activity.id), :class=> "c_blue" %>
|
||||
<%= student_work_activity_submit_status(homework: activity) %>
|
||||
</div>
|
||||
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %></div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<% has_commit = has_commit_poll?(activity.id ,User.current)%>
|
||||
<% poll_name = activity.polls_name.empty? ? l(:label_poll_new) : activity.polls_name%>
|
||||
<% if has_commit || activity.user_id == User.current %>
|
||||
<% if ( activity.polls_status==2) %>
|
||||
<div class="resources mt10">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
<div> <%= l('userscore.active.update_issues')%> * 2 = <%= option_num.issue_done_ratio %> * 2 = <%= option_num.issue_done_ratio * 2 %></div>
|
||||
<div> <%= l('userscore.active.release_issues')%> * 4 = <%= option_num.post_issue %> * 4 = <%= option_num.post_issue * 4 %></div>
|
||||
<div> <%= l('userscore.active.release_messages')%> * 1 = <%= option_num.memo %> * 2 = <%= option_num.memo * 2 %></div>
|
||||
<div> <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= active(option_num) %> </div>
|
||||
<div> <%= l(:label_user_score_of_active)%> = <%= option_num.changeset * 4 %> + <%= option_num.document * 4 %> + <%= option_num.attachment * 4 %> + <%= option_num.issue_done_ratio * 2 %> + <%= option_num.post_issue * 4 %> + <%= option_num.memo * 2 %> = <%= project_active(option_num) %> </div>
|
|
@ -5,8 +5,8 @@
|
|||
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
|
||||
<!-- <div> + <%#= l(:label_user_score_of_influence) %></div> -->
|
||||
<div> = <%= format("%.2f" ,collaboration(option_num)).to_i %> + <%= format("%.2f" , influence(option_num) ).to_i %>
|
||||
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" , active(option_num)).to_i %></div>
|
||||
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , active(option_num)).to_i) < 0 %>
|
||||
+ <%= "(" if skill(option_num) < 0 %> <%= format("%.2f" , skill(option_num)).to_i %> <%= ")" if skill(option_num) < 0 %> + <%= format("%.2f" ,project_active(option_num)).to_i %></div>
|
||||
<% if (format("%.2f" ,collaboration(option_num)).to_i + format("%.2f" , influence(option_num) ).to_i + format("%.2f" , skill(option_num)).to_i + format("%.2f" , project_active(option_num)).to_i) < 0 %>
|
||||
<div><%= l(:label_score_less_than_zero) %></div>
|
||||
<% else %>
|
||||
<div> = <%= format("%.2f" ,option_num.total_score).to_i %></div>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
</li>
|
||||
<li>
|
||||
<%= link_to l(:label_user_score_of_active), "javascript:void(0)", :onclick => "show_div('influence_new_score_index')" %> :
|
||||
<%= format("%.2f" , active(option_num)).to_i %>
|
||||
<%= format("%.2f" , project_active(option_num)).to_i %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
<li>
|
||||
<ul class="homepagePostTypeProject fl">
|
||||
<li class="f14">更多</li>
|
||||
<li class="mt-4"><%= link_to "我的动态", {:controller => "users", :action => "show", :type => "current_user"}, :class =>"homepagePostTypeAll postTypeGrey"%>
|
||||
<li class="mt-4"><%= link_to "全部动态", {:controller => "users", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -29,7 +29,11 @@
|
|||
</div>
|
||||
<div class="resources mt10" id="users_setting">
|
||||
<div>
|
||||
|
||||
<% if params[:type].nil? %>
|
||||
<div class="newsReadSetting">
|
||||
有 <span class="c_red"><%= User.current.count_new_message %></span> 条未读<a href="javascript:void(0);" class="ml15"><%= link_to "全部设为已读", user_message_path(User.current, :viewed => 'all') %></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if @message_alls.count >0 %>
|
||||
<%# 课程消息 %>
|
||||
<% unless @message_alls.nil? %>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
class ForgeActivituesDate < ActiveRecord::Migration
|
||||
def up
|
||||
forge_count = ForgeActivity.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... forge_count do i
|
||||
ForgeActivity.page(i).per(30).each do |activity|
|
||||
unless activity.forge_act_type == "ProjectCreateInfo"
|
||||
if activity.forge_act
|
||||
unless activity.forge_act.project
|
||||
# puts activity.id
|
||||
activity.destroy
|
||||
end
|
||||
else
|
||||
# puts activity.id.to_s + "----"
|
||||
activity.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class DeleteAnonymousJour < ActiveRecord::Migration
|
||||
def up
|
||||
jour_count = Journal.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... jour_count do i
|
||||
Journal.page(i).per(30).each do |jour|
|
||||
jour.destroy if jour.user_id == 2
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddUserIdToUserActivities < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :user_activities, :user_id, :int
|
||||
end
|
||||
end
|
|
@ -0,0 +1,40 @@
|
|||
class UpdateUserActivities < ActiveRecord::Migration
|
||||
def up
|
||||
count = UserActivity.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
UserActivity.page(i).per(30).each do |activity|
|
||||
if activity.container_type.to_s == 'Project'
|
||||
forge_activity = ForgeActivity.where("forge_act_type = '#{activity.act_type.to_s}' and forge_act_id = #{activity.act_id}").first
|
||||
if forge_activity
|
||||
activity.user_id = forge_activity.user_id
|
||||
else
|
||||
activity.user_id = 0
|
||||
end
|
||||
|
||||
elsif activity.container_type.to_s == 'Course'
|
||||
course_activity = CourseActivity.where("course_act_type = '#{activity.act_type.to_s}' and course_act_id = #{activity.act_id}").first
|
||||
if course_activity
|
||||
activity.user_id = course_activity.user_id
|
||||
else
|
||||
activity.user_id = 0
|
||||
end
|
||||
end
|
||||
activity.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
count = UserActivity.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
UserActivity.page(i).per(30).each do |activity|
|
||||
activity.user_id = nil
|
||||
activity.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
19
db/schema.rb
19
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20150829070453) do
|
||||
ActiveRecord::Schema.define(:version => 20150907064547) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -476,13 +476,6 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
|
|||
|
||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||
|
||||
create_table "discuss_demos", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "body"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "documents", :force => true do |t|
|
||||
t.integer "project_id", :default => 0, :null => false
|
||||
t.integer "category_id", :default => 0, :null => false
|
||||
|
@ -913,6 +906,7 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
|
|||
t.datetime "created_on"
|
||||
t.integer "comments_count", :default => 0, :null => false
|
||||
t.integer "course_id"
|
||||
t.datetime "updated_on"
|
||||
end
|
||||
|
||||
add_index "news", ["author_id"], :name => "index_news_on_author_id"
|
||||
|
@ -1296,11 +1290,11 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
|
|||
|
||||
create_table "student_work_tests", :force => true do |t|
|
||||
t.integer "student_work_id"
|
||||
t.integer "homework_test_id"
|
||||
t.integer "result"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "error_msg"
|
||||
t.integer "status", :default => 9
|
||||
t.text "results"
|
||||
t.text "src"
|
||||
end
|
||||
|
||||
create_table "student_works", :force => true do |t|
|
||||
|
@ -1317,6 +1311,7 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
|
|||
t.datetime "updated_at", :null => false
|
||||
t.integer "late_penalty", :default => 0
|
||||
t.integer "absence_penalty", :default => 0
|
||||
t.integer "system_score"
|
||||
end
|
||||
|
||||
create_table "student_works_evaluation_distributions", :force => true do |t|
|
||||
|
@ -1420,6 +1415,7 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
|
|||
t.integer "container_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "user_extensions", :force => true do |t|
|
||||
|
@ -1534,7 +1530,6 @@ ActiveRecord::Schema.define(:version => 20150829070453) do
|
|||
t.string "identity_url"
|
||||
t.string "mail_notification", :default => "", :null => false
|
||||
t.string "salt", :limit => 64
|
||||
t.integer "gid"
|
||||
end
|
||||
|
||||
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
|
||||
|
|
|
@ -42,7 +42,7 @@ $(function(){
|
|||
data.index = $('.ProResultTop').length+1;
|
||||
}
|
||||
|
||||
if (typeof cb == 'function') {cb(); return;}
|
||||
if (typeof cb == 'function') {cb(data); return;}
|
||||
|
||||
|
||||
var html=bt('t:result-list',data);
|
||||
|
@ -74,7 +74,13 @@ $(function(){
|
|||
}
|
||||
|
||||
if (!tested) {
|
||||
test_program(function(){
|
||||
test_program(function(data){
|
||||
if (data.status!=0) {
|
||||
var r=confirm("测试不通过,是否强制提交?");
|
||||
if (!r) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
$(".HomeWorkCon form").submit();
|
||||
});
|
||||
return;
|
||||
|
|
|
@ -210,7 +210,7 @@ span[id^=valid_user] {
|
|||
p.jRatingInfos {
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
background: transparent url('bg_jRatingInfos.png') no-repeat;
|
||||
/*background: transparent url('bg_jRatingInfos.png') no-repeat;*/
|
||||
color: #CACACA;
|
||||
display: none;
|
||||
width: 91px;
|
||||
|
|
|
@ -418,6 +418,8 @@ div.flash.notice {
|
|||
background-color: #dfffdf;
|
||||
border-color: #9fcf9f;
|
||||
color: #005f00;
|
||||
word-wrap: break-word;
|
||||
word-break: break-all
|
||||
}
|
||||
|
||||
div.flash.warning, .conflict {
|
||||
|
|
Loading…
Reference in New Issue