Merge branch 'develop' into experiment
This commit is contained in:
commit
3c0f41a64c
|
@ -7,20 +7,16 @@ class CoursesController < ApplicationController
|
|||
def join
|
||||
if User.current.logged?
|
||||
course = Project.find(params[:object_id])
|
||||
if ( !course_endTime_timeout?(course) )
|
||||
course_prefs = Course.find_by_extra(course.identifier)
|
||||
if params[:course_password] == course_prefs.password
|
||||
course_prefs = Course.find_by_extra(course.identifier)
|
||||
if params[:course_password] == course_prefs.password
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => User.current.id)
|
||||
course.members << members
|
||||
|
||||
|
||||
StudentsForCourse.create(:student_id => User.current.id, :course_id => params[:object_id])
|
||||
@state = 0
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
else
|
||||
@state = 2
|
||||
@state = 1
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
|
@ -49,7 +45,18 @@ class CoursesController < ApplicationController
|
|||
private
|
||||
|
||||
def allow_join
|
||||
course_endTime_timeout? Project.find(params[:object_id])
|
||||
if course_endTime_timeout? Project.find(params[:object_id])
|
||||
respond_to do |format|
|
||||
format.js{
|
||||
@state = 2
|
||||
render :partial => 'set_join',
|
||||
:locals => {:user => User.current,
|
||||
:course => Project.find(params[:object_id]),
|
||||
:object_id => params[:object_id]
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue