加入课程或者已经加入的课程,提示后进行跳转

This commit is contained in:
lizanle 2015-08-10 15:31:23 +08:00
parent 44f22feefd
commit a282d81551
2 changed files with 10 additions and 3 deletions

View File

@ -39,9 +39,14 @@ class CoursesController < ApplicationController
else
@state = 5 #未登录
end
respond_to do |format|
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
end
# if @state == 1 || @state == 3
# respond_to course_path(course.id)
# else
respond_to do |format|
format.js { render :partial => 'set_join', :locals => {:user => user, :course => course, :object_id => params[:object_id]} }
end
#end
rescue Exception => e
@state = 4 #已经加入了课程
respond_to do |format|

View File

@ -6,12 +6,14 @@
alert("加入成功");
hideModal($("#popbox02"));
$("#try_join_course_link").replaceWith("<a href='<%=url_for(:controller => 'homework_common', :action => 'index',:course=>course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品</a>");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
<% elsif @state == 3 %>
alert("您已经加入了课程");
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
<% elsif @state == 4 %>
alert("您加入的课程不存在");
<% elsif @state == 5 %>