Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
5954ba1788
|
@ -148,7 +148,7 @@ class WelcomeController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||
def entry_select
|
||||
url = request.original_url
|
||||
if url.include?("course.trustie.net")
|
||||
|
@ -166,28 +166,6 @@ class WelcomeController < ApplicationController
|
|||
|
||||
end
|
||||
|
||||
# 判断网站的入口,是课程 course 则跳过index去渲染 course 方法
|
||||
def entry_select_course
|
||||
if request.original_url.match(/.*course\.trustie\.net/)
|
||||
(course() and render :course and return 0)
|
||||
end
|
||||
end
|
||||
|
||||
def entry_select_contest
|
||||
if request.original_url.match(/.*contest\.trustie\.net/)
|
||||
contest
|
||||
render :contest
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
def entry_select_user
|
||||
if request.original_url.match(/.*user\.trustie\.net$/)
|
||||
redirect_to(:controller => "users", :action => "index")
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
# def render(*args)
|
||||
# _fake if @fake_filter
|
||||
# super
|
||||
|
|
|
@ -56,13 +56,12 @@ class Project < ActiveRecord::Base
|
|||
#added by xianbo for delete biding_project
|
||||
has_many :biding_projects, :dependent => :destroy
|
||||
has_many :contesting_projects, :dependent => :destroy
|
||||
has_many :projecting_softapplications, :dependent => :destroy
|
||||
has_many :softapplications, :through => :projecting_softapplications
|
||||
#ended by xianbo
|
||||
# added by fq
|
||||
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
|
||||
has_many :homework_for_courses, :dependent => :destroy
|
||||
has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||
#has_many :homework_for_courses, :dependent => :destroy
|
||||
#has_many :homeworks, :through => :homework_for_courses, :source => :bid, :dependent => :destroy
|
||||
has_many :shares, :dependent => :destroy
|
||||
# has_many :students_for_courses, :dependent => :destroy
|
||||
has_many :student, :through => :students_for_courses, :source => :user
|
||||
|
|
|
@ -10,6 +10,7 @@ class CoursesControllerTest < ActionController::TestCase
|
|||
Setting.default_language = 'en'
|
||||
end
|
||||
|
||||
# Get :index
|
||||
def test_index_by_anonymous_should_not_show_private_projects
|
||||
get :index
|
||||
assert_response :success
|
||||
|
@ -19,6 +20,7 @@ class CoursesControllerTest < ActionController::TestCase
|
|||
assert courses.all?(&:is_public?)
|
||||
end
|
||||
|
||||
# Get :new
|
||||
# 人员添加课程的权限是不属于任何角色
|
||||
def test_new_course_anyone_temporary
|
||||
@request.session[:user_id] = 5
|
||||
|
@ -29,6 +31,7 @@ class CoursesControllerTest < ActionController::TestCase
|
|||
assert_template :new
|
||||
end
|
||||
|
||||
# post :create
|
||||
def test_create_course_with_access_control
|
||||
@request.session[:user_id] = 5
|
||||
Role.find_by_name("Non member").add_permission! :add_course #Non member
|
||||
|
@ -54,6 +57,7 @@ class CoursesControllerTest < ActionController::TestCase
|
|||
# assert_redirected_to "courses/#{course.id}/settings"
|
||||
end
|
||||
|
||||
# post :create 403
|
||||
def test_create_course_without_access_control
|
||||
@request.session[:user_id] = 5
|
||||
#Role.find_by_name("Non member").add_permission! :add_course #Non member
|
||||
|
|
Loading…
Reference in New Issue