diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index 05f04630..251e6de7 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -54,6 +54,12 @@ class WelcomeController < ApplicationController
end
end
+ def join_private_courses
+ @invitation_code = params[:invitation_code]
+ respond_to do |format|
+ format.js
+ end
+ end
def shixun_to_local
identifiers = params[:identifiers].split(",")
diff --git a/app/views/competitions/_qg_second_opensource.html.erb b/app/views/competitions/_qg_second_opensource.html.erb
index ddaad572..193e4d1c 100644
--- a/app/views/competitions/_qg_second_opensource.html.erb
+++ b/app/views/competitions/_qg_second_opensource.html.erb
@@ -45,7 +45,7 @@
invite_code = nil
if first_entry.url.present?
- course_id = first_entry.url.split('/')[-2, 1]
+ course_id = first_entry.url.split('/')[-5, 1]
course = Course.find_by_id(course_id)
if course.present? && @user && @user.logged?
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 0277fe05..6b9cde10 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -85,7 +85,7 @@
<%= link_to '新建项目', new_project_path() %>
- - <%= link_to "加入课堂", join_private_courses_users_path, :remote => true %>
+ - <%= link_to "加入课堂", join_private_courses_path, :remote => true %>
diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb
index eb10c8d6..d54b65f5 100644
--- a/app/views/layouts/_unlogin_header.html.erb
+++ b/app/views/layouts/_unlogin_header.html.erb
@@ -51,9 +51,9 @@
- 登录
+ 登录
- 登录
+ 注册
<%#= link_to '注册', user_join_path, :class => "ml5 color-white" %>
diff --git a/app/views/welcome/join_private_courses.js.erb b/app/views/welcome/join_private_courses.js.erb
new file mode 100644
index 00000000..35214ee0
--- /dev/null
+++ b/app/views/welcome/join_private_courses.js.erb
@@ -0,0 +1,2 @@
+var htmlvalue = "<%= escape_javascript(render :partial => 'courses/join_private_course') %>";
+pop_box_new(htmlvalue,460,220);
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 9ab407ee..1df0c29c 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1670,7 +1670,6 @@ RedmineApp::Application.routes.draw do ## oauth相关
get 'html_show'
get 'switch_user_module'
get 'reward_grade'
- match 'join_private_courses', :via => [:get, :post]
end
member do
@@ -2606,6 +2605,7 @@ RedmineApp::Application.routes.draw do ## oauth相关
########################
##added by wen##########
#######confusing########
+ match 'welcome/join_private_courses', to: 'welcome#join_private_courses', :via => [:get, :post], :as => 'join_private_courses'
get 'welcome/search', to: 'welcome#search'
get 'school/index', to: 'school#index'
get 'school/:school_id', to: