From 5434a5b0877dbc521d175d0b0fa35ae8c87a983e Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Tue, 27 Jan 2015 15:29:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=8Aadmin=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=AE=BF=E9=97=AEcourses=E5=92=8Cusers=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E3=80=8B=20Signed-off-by:=20alan=20<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 5 +++++ app/controllers/courses_controller.rb | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 6677141c9..20107dba6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -130,6 +130,7 @@ GEM rspec (~> 2.11) hashie (3.3.1) hike (1.2.3) + hitimes (1.2.2) hitimes (1.2.2-x86-mingw32) htmlentities (4.3.2) i18n (0.6.1) @@ -176,6 +177,10 @@ GEM cocaine (~> 0.5.3) mime-types 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) coderay (~> 1.0) method_source (~> 0.8) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 161918094..e81b57ad7 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -8,6 +8,7 @@ class CoursesController < ApplicationController menu_item :overview menu_item :feedback, :only => :feedback menu_item :homework, :only => :homework + menu_item :new_homework, :only => :new_homework menu_item l(:label_sort_by_time), :only => :index @@ -675,8 +676,10 @@ class CoursesController < ApplicationController end def index - render_404 unless User.current.admin? - + if !User.current.admin? + render_404 + return + end @course_type = params[:course_type] @school_id = params[:school_id] per_page_option = 10 @@ -724,7 +727,7 @@ class CoursesController < ApplicationController respond_to do |format| format.html { - # render :layout => 'base' + render :layout => 'base' } format.atom { courses = Course.visible.order('created_on DESC').limit(Setting.feeds_limit.to_i).all