diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 1b186b5f2..47d343e8f 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -749,7 +749,7 @@ module CoursesHelper if user.logged? joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id text = joined ? l(:label_course_exit_student) : l(:label_course_join_student) - url = joined ? course_path(course.id) : try_join_path(:object_id => course.id) + url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id) method = joined ? 'delete' : 'post' if joined link = link_to(text, url, :remote => true, :method => method, :class => "pr_join_a", :id => "#{course.id}", :confirm => l(:text_are_you_sure_out)) diff --git a/app/views/courses/join.js.erb b/app/views/courses/join.js.erb index 8102098d5..04a77f87b 100644 --- a/app/views/courses/join.js.erb +++ b/app/views/courses/join.js.erb @@ -6,14 +6,14 @@ $("#join_in_course_header").html("<%= escape_javascript(join_in_course_header(@c alert("加入成功"); hideModal(); $("#try_join_course_link").replaceWith(" 'index',:course=>@course.id, :host=>Setting.host_course)%>' target='_blank' class='blue_n_btn fr mt20'>提交作品"); -window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +window.location.href= "<%= Setting.protocol%>://"+"<%= 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%>" +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" <% elsif @state == 4 %> alert("您加入的课程不存在"); <% elsif @state == 5 %> @@ -27,15 +27,15 @@ hidden_join_course_form(); <% elsif @state == 8%> alert("您已经是该课程的教师了"); hidden_join_course_form(); -window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" <% elsif @state == 9%> alert("您已经是该课程的教辅了"); hidden_join_course_form(); -window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" <% elsif @state == 10%> alert("您已经是该课程的管理员了"); hidden_join_course_form(); -window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" +window.location.href= "<%= Setting.protocol%>://"+"<%= Setting.host_name%>"+"/courses/" + "<%= @course.id%>" <% else %> alert("未知错误,请稍后再试"); <% end %>