From 3e44fe368b93b3a48d0c81ff8a738c45166d10aa Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Apr 2019 11:05:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E8=BA=AB=E4=BB=BD?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=96=B0=E5=BB=BA=E8=AF=BE=E5=A0=82=E5=85=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 8 +++++++- app/views/layouts/_logined_header.html.erb | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) 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 @@