修改《admin可以访问courses和users列表》
Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
parent
36dfd7c77c
commit
5434a5b087
|
@ -130,6 +130,7 @@ GEM
|
||||||
rspec (~> 2.11)
|
rspec (~> 2.11)
|
||||||
hashie (3.3.1)
|
hashie (3.3.1)
|
||||||
hike (1.2.3)
|
hike (1.2.3)
|
||||||
|
hitimes (1.2.2)
|
||||||
hitimes (1.2.2-x86-mingw32)
|
hitimes (1.2.2-x86-mingw32)
|
||||||
htmlentities (4.3.2)
|
htmlentities (4.3.2)
|
||||||
i18n (0.6.1)
|
i18n (0.6.1)
|
||||||
|
@ -176,6 +177,10 @@ GEM
|
||||||
cocaine (~> 0.5.3)
|
cocaine (~> 0.5.3)
|
||||||
mime-types
|
mime-types
|
||||||
polyglot (0.3.5)
|
polyglot (0.3.5)
|
||||||
|
pry (0.9.12.6)
|
||||||
|
coderay (~> 1.0)
|
||||||
|
method_source (~> 0.8)
|
||||||
|
slop (~> 3.4)
|
||||||
pry (0.9.12.6-x86-mingw32)
|
pry (0.9.12.6-x86-mingw32)
|
||||||
coderay (~> 1.0)
|
coderay (~> 1.0)
|
||||||
method_source (~> 0.8)
|
method_source (~> 0.8)
|
||||||
|
|
|
@ -8,6 +8,7 @@ class CoursesController < ApplicationController
|
||||||
menu_item :overview
|
menu_item :overview
|
||||||
menu_item :feedback, :only => :feedback
|
menu_item :feedback, :only => :feedback
|
||||||
menu_item :homework, :only => :homework
|
menu_item :homework, :only => :homework
|
||||||
|
|
||||||
menu_item :new_homework, :only => :new_homework
|
menu_item :new_homework, :only => :new_homework
|
||||||
|
|
||||||
menu_item l(:label_sort_by_time), :only => :index
|
menu_item l(:label_sort_by_time), :only => :index
|
||||||
|
@ -675,8 +676,10 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render_404 unless User.current.admin?
|
if !User.current.admin?
|
||||||
|
render_404
|
||||||
|
return
|
||||||
|
end
|
||||||
@course_type = params[:course_type]
|
@course_type = params[:course_type]
|
||||||
@school_id = params[:school_id]
|
@school_id = params[:school_id]
|
||||||
per_page_option = 10
|
per_page_option = 10
|
||||||
|
@ -724,7 +727,7 @@ class CoursesController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
# render :layout => 'base'
|
render :layout => 'base'
|
||||||
}
|
}
|
||||||
format.atom {
|
format.atom {
|
||||||
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all
|
||||||
|
|
Loading…
Reference in New Issue