course manager can not apply to join that course

This commit is contained in:
lizanle 2015-11-03 11:42:33 +08:00
parent d4218fc81b
commit 8ffbe8f300
2 changed files with 7 additions and 0 deletions

View File

@ -303,6 +303,7 @@ class CoursesService
#@state == 7 您已经发送过申请了,请耐心等待
#@state == 8 您已经是该课程的教师了
#@state == 9 您已经是该课程的教辅了
#@state == 10 您已经是该课程的管理员了
#@state 其他 未知错误,请稍后再试
def join_course params,current_user
course = Course.find_by_id params[:object_id]
@ -325,6 +326,8 @@ class CoursesService
#如果加入的角色教辅并且当前为教辅
elsif params[:role] == "7" && roleName == "TeachingAsistant"
@state = 9
elsif roleName == "Manager"
@state = 10
#如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
#如果已经发送过消息了,那么就要给个提示

View File

@ -32,6 +32,10 @@ window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @co
alert("您已经是该课程的教辅了");
hidden_join_course_form();
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% elsif @state == 10%>
alert("您已经是该课程的管理员了");
hidden_join_course_form();
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>"
<% else %>
alert("未知错误,请稍后再试");
<% end %>