|
|
@ -13,7 +13,7 @@ class EcMajorSchoolsController < ApplicationController
|
|
|
|
# 这个status 用于创建界别时,局部刷新的状态
|
|
|
|
# 这个status 用于创建界别时,局部刷新的状态
|
|
|
|
@status = params[:status]
|
|
|
|
@status = params[:status]
|
|
|
|
|
|
|
|
|
|
|
|
@btn_text = @major_school.template_major && User.current.admin? ? "立即配置" :
|
|
|
|
@btn_text = @major_school.template_major && admin_or_business? ? "立即配置" :
|
|
|
|
(!@major_school.template_major && @major_manager ? "立即配置" : "查看")
|
|
|
|
(!@major_school.template_major && @major_manager ? "立即配置" : "查看")
|
|
|
|
|
|
|
|
|
|
|
|
if params[:search]
|
|
|
|
if params[:search]
|
|
|
@ -84,7 +84,7 @@ class EcMajorSchoolsController < ApplicationController
|
|
|
|
user_url = user_path(User.current)
|
|
|
|
user_url = user_path(User.current)
|
|
|
|
year = @year.year
|
|
|
|
year = @year.year
|
|
|
|
# 学校操作权限
|
|
|
|
# 学校操作权限
|
|
|
|
template_major = User.current.admin? || major.school.ec_school_users.pluck(:user_id).include?(User.current.id)
|
|
|
|
template_major = admin_or_business? || major.school.ec_school_users.pluck(:user_id).include?(User.current.id)
|
|
|
|
# 示例专业
|
|
|
|
# 示例专业
|
|
|
|
example_major = major.template_major
|
|
|
|
example_major = major.template_major
|
|
|
|
ec_course_support_setting_url = ec_course_support_setting_ec_course_path(ec_course) if ec_course.present?
|
|
|
|
ec_course_support_setting_url = ec_course_support_setting_ec_course_path(ec_course) if ec_course.present?
|
|
|
@ -130,7 +130,7 @@ class EcMajorSchoolsController < ApplicationController
|
|
|
|
competition_calculation_info_url: competition_calculation_info_url,
|
|
|
|
competition_calculation_info_url: competition_calculation_info_url,
|
|
|
|
score_level_setting_url: score_level_setting_url,
|
|
|
|
score_level_setting_url: score_level_setting_url,
|
|
|
|
example_major: example_major,
|
|
|
|
example_major: example_major,
|
|
|
|
allow_visit: User.current.admin? || (User.current.ec_school.present? && User.current.ec_school == major.school.id)
|
|
|
|
allow_visit: admin_or_business? || (User.current.ec_school.present? && User.current.ec_school == major.school.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -159,7 +159,7 @@ class EcMajorSchoolsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def add_manager
|
|
|
|
def add_manager
|
|
|
|
@is_school_manager = User.current.admin? || @major_school.school.users.where(:id => User.current.id).count > 0 # 学校管理员
|
|
|
|
@is_school_manager = admin_or_business? || @major_school.school.users.where(:id => User.current.id).count > 0 # 学校管理员
|
|
|
|
if @is_school_manager || @major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0
|
|
|
|
if @is_school_manager || @major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0
|
|
|
|
params[:user_id].each do |user_id|
|
|
|
|
params[:user_id].each do |user_id|
|
|
|
|
if @major_school.ec_major_school_users.count < 5 && @major_school.ec_major_school_users.where(:user_id => user_id).count == 0
|
|
|
|
if @major_school.ec_major_school_users.count < 5 && @major_school.ec_major_school_users.where(:user_id => user_id).count == 0
|
|
|
@ -172,7 +172,7 @@ class EcMajorSchoolsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def delete_manager
|
|
|
|
def delete_manager
|
|
|
|
@is_school_manager = User.current.admin? || @major_school.school.users.where(:id => User.current.id).count > 0 # 学校管理员
|
|
|
|
@is_school_manager = admin_or_business? || @major_school.school.users.where(:id => User.current.id).count > 0 # 学校管理员
|
|
|
|
if @is_school_manager || @major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0
|
|
|
|
if @is_school_manager || @major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0
|
|
|
|
@major_school.ec_major_school_users.where(:user_id => params[:user_id]).destroy_all
|
|
|
|
@major_school.ec_major_school_users.where(:user_id => params[:user_id]).destroy_all
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -184,7 +184,7 @@ class EcMajorSchoolsController < ApplicationController
|
|
|
|
def find_major_school
|
|
|
|
def find_major_school
|
|
|
|
@major_school = EcMajorSchool.find(params[:id])
|
|
|
|
@major_school = EcMajorSchool.find(params[:id])
|
|
|
|
# 管理员权限
|
|
|
|
# 管理员权限
|
|
|
|
@major_manager = User.current.admin? || @major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
|
|
|
|
@major_manager = admin_or_business? || @major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 职业认证的权限判断
|
|
|
|
# 职业认证的权限判断
|
|
|
|