diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 57d57938..b65f2219 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1481,14 +1481,14 @@ class CoursesController < ApplicationController def new if User.current.login? - @course_type = params[:course_type] ||= params[:course] - @issue_custom_fields = IssueCustomField.sorted.all - @trackers = Tracker.sorted.all - @course = Course.new - @course.safe_attributes = params[:course] - @syllabus = Syllabus.where("id = #{params[:syllabus_id].to_i}").first if params[:syllabus_id] - # month = Time.now.month - render :layout => 'base_edu' + if User.current.user_extensions.try(:identity) == 1 + render_403 + else + @course = Course.new + @course.safe_attributes = params[:course] + # month = Time.now.month + render :layout => 'base_edu' + end else redirect_to signin_url end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 5a160436..d13db006 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2562,7 +2562,13 @@ class UsersController < ApplicationController # 用户访问自己主页的"我管理的"列表,且是第一页才显示新建入口 page = params[:page] ? params[:page].to_i : 1 - @new_icon = @user == User.current && ['a_course', 'a_shixun', 'a_project', 'a_path'].include?(@type) && page == 1 + + # 学生身份没有课堂的新建入口 + if @user.user_extensions.try(:identity) == 1 + @new_icon = @user == User.current && ['a_shixun', 'a_project', 'a_path'].include?(@type) && page == 1 + else + @new_icon = @user == User.current && ['a_course', 'a_shixun', 'a_project', 'a_path'].include?(@type) && page == 1 + end # 用户进自己主页的全部列表时有个新建入口,加一个"new",view层的第一页需要shift,这样翻页就没问题啦 @objects = @objects.to_a diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 0cfd2916..6b282631 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -73,7 +73,9 @@