Merge branch 'develop' of http://repository.trustie.net/xianbo/trustie2 into develop
This commit is contained in:
commit
cc0ff6bbc0
|
@ -167,6 +167,12 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
# 提交作品前先判断是否已经提交
|
||||||
|
if hsd_committed_work?(User.current.id, @homework.id)
|
||||||
|
flash[:notice] = l(:notice_successful_create)
|
||||||
|
redirect_to edit_student_work_url(params[:student_work])
|
||||||
|
return
|
||||||
|
end
|
||||||
if params[:student_work]
|
if params[:student_work]
|
||||||
@submit_result = true
|
@submit_result = true
|
||||||
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
|
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
|
||||||
|
@ -499,6 +505,12 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
def hsd_committed_work?(user, homework)
|
||||||
|
sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first
|
||||||
|
sw.nil? ? result = false : result = true
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
#获取作业
|
#获取作业
|
||||||
def find_homework
|
def find_homework
|
||||||
@homework = HomeworkCommon.find params[:homework]
|
@homework = HomeworkCommon.find params[:homework]
|
||||||
|
|
|
@ -94,4 +94,6 @@ zh:
|
||||||
label_user_name: "用户名称"
|
label_user_name: "用户名称"
|
||||||
#setting end
|
#setting end
|
||||||
|
|
||||||
label_course_poll: 课程问卷
|
label_course_poll: 课程问卷
|
||||||
|
|
||||||
|
label_homework_committed: 你已经提交过作品,如果你想修改作品的话,可以在作品列表页面对作品信息进行修改。
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -11,7 +11,7 @@ module Trustie
|
||||||
base.class_eval {
|
base.class_eval {
|
||||||
#before_create :add_gitlab_user
|
#before_create :add_gitlab_user
|
||||||
#before_destroy :delete_gitlab_user
|
#before_destroy :delete_gitlab_user
|
||||||
before_save :change_gitlab_user
|
#before_save :change_gitlab_user
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,10 +22,10 @@ module Trustie
|
||||||
def delete_gitlab_user
|
def delete_gitlab_user
|
||||||
del_user(self)
|
del_user(self)
|
||||||
end
|
end
|
||||||
|
#
|
||||||
def change_gitlab_user
|
#def change_gitlab_user
|
||||||
change_password(self.gid, self.hashed_password, self.salt)
|
# change_password(self.gid, self.hashed_password, self.salt)
|
||||||
end
|
#end
|
||||||
|
|
||||||
def g
|
def g
|
||||||
@g ||= ::Gitlab.client
|
@g ||= ::Gitlab.client
|
||||||
|
|
Loading…
Reference in New Issue