socialforge/app/views/courses/join.js.erb

47 lines
2.0 KiB
Plaintext
Raw Normal View History

2015-10-24 11:19:11 +08:00
<% if @object_id && @state != 6 && @state !=4 %>
2015-10-20 17:27:06 +08:00
$("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@course, @user)) %>");
<% end %>
<% if @state %>
<% if @state == 0 %>
alert("加入成功");
hideModal();
$("#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>");
2016-06-24 18:50:47 +08:00
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
2015-10-20 17:27:06 +08:00
<% elsif @state == 1 %>
alert("密码错误");
<% elsif @state == 2 %>
2016-07-01 20:38:33 +08:00
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
2015-10-20 17:27:06 +08:00
<% elsif @state == 3 %>
2016-07-01 20:38:33 +08:00
alert("您已经加入了班级");
2016-06-24 18:50:47 +08:00
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
2015-10-20 17:27:06 +08:00
<% elsif @state == 4 %>
2016-07-01 20:38:33 +08:00
alert("您加入的班级不存在");
2015-10-20 17:27:06 +08:00
<% elsif @state == 5 %>
alert("您还未登录");
<% elsif @state == 6 %>
2015-10-24 16:16:04 +08:00
alert("申请成功,请等待审核");
hidden_join_course_form();
<% elsif @state == 7%>
2015-10-24 16:16:04 +08:00
alert("您已经发送过申请了,请耐心等待");
hidden_join_course_form();
<% elsif @state == 8%>
2016-07-01 20:38:33 +08:00
alert("您已经是该班级的教师了");
hidden_join_course_form();
2016-06-24 18:50:47 +08:00
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 9%>
2016-07-01 20:38:33 +08:00
alert("您已经是该班级的教辅了");
hidden_join_course_form();
2016-06-24 18:50:47 +08:00
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 10%>
2016-07-01 20:38:33 +08:00
alert("您已经是该班级的管理员了");
hidden_join_course_form();
2016-06-24 18:50:47 +08:00
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
2016-07-29 19:19:58 +08:00
<% elsif @state == 11%>
alert("该班级已被删除");
hidden_join_course_form();
window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
2015-10-20 17:27:06 +08:00
<% else %>
alert("未知错误,请稍后再试");
<% end %>
<% end %>