过滤器过滤加入课程的行为,不再进行n多判断
This commit is contained in:
parent
e1ddb3b0f6
commit
f9e9404471
|
@ -7,7 +7,6 @@ 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
|
||||
members = []
|
||||
|
@ -19,9 +18,6 @@ class CoursesController < ApplicationController
|
|||
else
|
||||
@state = 1
|
||||
end
|
||||
else
|
||||
@state = 2
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
|
||||
|
@ -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