Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
b727d023b6
|
@ -18,7 +18,7 @@
|
||||||
class WelcomeController < ApplicationController
|
class WelcomeController < ApplicationController
|
||||||
caches_action :robots
|
caches_action :robots
|
||||||
# before_filter :fake, :only => [:index, :course]
|
# before_filter :fake, :only => [:index, :course]
|
||||||
before_filter :entry_select_course, :entry_select_contest, :entry_select_user, :only => [:index]
|
before_filter :entry_select, :only => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
||||||
|
@ -92,9 +92,27 @@ class WelcomeController < ApplicationController
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def entry_select
|
||||||
|
url = request.original_url
|
||||||
|
if url.include?("course.trustie.net")
|
||||||
|
render :course
|
||||||
|
return 0
|
||||||
|
elsif url.include?("contest.trustie.net")
|
||||||
|
contest
|
||||||
|
render :contest
|
||||||
|
return 0
|
||||||
|
elsif url.include?("user.trustie.net")
|
||||||
|
redirect_to(:controller => "users", :action => "index")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||||
def entry_select_course
|
def entry_select_course
|
||||||
(course() and render :course and return 0) if request.original_url.match(/course\.trustie\.net/)
|
if request.original_url.match(/course\.trustie\.net/)
|
||||||
|
(course() and render :course and return 0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def entry_select_contest
|
def entry_select_contest
|
||||||
|
|
Loading…
Reference in New Issue