Merge branch 'develop' into educoder

dev_library
caishi 6 years ago
commit eb5563018b

@ -66,6 +66,8 @@ class ApplicationController < ActionController::Base
include Redmine::MenuManager::MenuController include Redmine::MenuManager::MenuController
helper Redmine::MenuManager::MenuHelper helper Redmine::MenuManager::MenuHelper
helper_method :admin_or_business?
# 云启训练场EduCoder个人版 产品编码appId 9200108 # 云启训练场EduCoder个人版 产品编码appId 9200108
# 产品名称 计费类型 套餐编码 # 产品名称 计费类型 套餐编码
# 云启训练场EduCoder个人版 固定包月 9200108001 # 云启训练场EduCoder个人版 固定包月 9200108001
@ -133,7 +135,7 @@ class ApplicationController < ActionController::Base
end end
def ec_public_auth major_school def ec_public_auth major_school
unless User.current.admin? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 || unless admin_or_business? || major_school.template_major || major_school.school.users.where(:id => User.current.id).count > 0 ||
major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 || major_school.ec_major_school_users.where(:user_id => User.current.id).count > 0 ||
EcCourseUser.where(:user_id => User.current.id, :ec_course_id => EcCourse.where(:ec_year_id => major_school.ec_years.pluck(:id)).pluck(:id)).count > 0 EcCourseUser.where(:user_id => User.current.id, :ec_course_id => EcCourse.where(:ec_year_id => major_school.ec_years.pluck(:id)).pluck(:id)).count > 0
render_403 render_403
@ -390,6 +392,10 @@ class ApplicationController < ActionController::Base
end end
end end
def admin_or_business?
User.current.business? || User.current.admin?
end
def deny_access def deny_access
User.current.logged? ? render_403 : require_login User.current.logged? ? render_403 : require_login
end end

@ -309,7 +309,7 @@ class EcCourseAchievementMethodsController < ApplicationController
@ec_course = EcCourse.find(params[:ec_course_id]) @ec_course = EcCourse.find(params[:ec_course_id])
@year = @ec_course.ec_year @year = @ec_course.ec_year
@ec_major_school = @year.ec_major_school @ec_major_school = @year.ec_major_school
@template_major = User.current.admin? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @template_major = admin_or_business? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
@ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) @ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
@is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id) @is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id)
end end

@ -298,7 +298,7 @@ class EcCourseEvaluationsController < ApplicationController
def find_course def find_course
@ec_course = EcCourse.find params[:ec_course_id] @ec_course = EcCourse.find params[:ec_course_id]
ec_major_school = @ec_course.ec_year.ec_major_school ec_major_school = @ec_course.ec_year.ec_major_school
@is_manager = User.current.admin? || ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @is_manager = admin_or_business? || ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id) ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id)
end end
@ -306,7 +306,7 @@ class EcCourseEvaluationsController < ApplicationController
@ce = EcCourseEvaluation.find params[:id] @ce = EcCourseEvaluation.find params[:id]
@ec_course = @ce.ec_course @ec_course = @ce.ec_course
ec_major_school = @ec_course.ec_year.ec_major_school ec_major_school = @ec_course.ec_year.ec_major_school
@is_manager = User.current.admin? || ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @is_manager = admin_or_business? || ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id) ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id)
end end
end end

@ -50,7 +50,7 @@ class EcCourseSupportsController < ApplicationController
max_support_count = 0 max_support_count = 0
subitems_count = 0 subitems_count = 0
major_school = @year.ec_major_school major_school = @year.ec_major_school
is_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) is_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)
ec_graduation_requirements.each_with_index do |gr, i| ec_graduation_requirements.each_with_index do |gr, i|
logger.info("#############index:#{i}#####_ec_gradiation_reqiorements: #{gr.id}") logger.info("#############index:#{i}#####_ec_gradiation_reqiorements: #{gr.id}")
subitems_count += gr.ec_graduation_subitems.count subitems_count += gr.ec_graduation_subitems.count

@ -346,7 +346,7 @@ class EcCoursesController < ApplicationController
# 关联课堂弹框-搜索 # 关联课堂弹框-搜索
def search_courses def search_courses
user = User.where(:id => params[:user_id]).first user = User.where(:id => params[:user_id]).first
if user.try(:admin?) if user.try(:admin?) || user.try(:business?)
courses = Course.where(:is_delete => 0) courses = Course.where(:is_delete => 0)
else else
course_ids = Member.where("user_id = #{user.try(:id)} and course_id != -1").pluck(:course_id) course_ids = Member.where("user_id = #{user.try(:id)} and course_id != -1").pluck(:course_id)
@ -588,7 +588,7 @@ class EcCoursesController < ApplicationController
@ec_course = EcCourse.find(params[:id]) @ec_course = EcCourse.find(params[:id])
@year = @ec_course.ec_year @year = @ec_course.ec_year
@ec_major_school = @year.ec_major_school @ec_major_school = @year.ec_major_school
@template_major = User.current.admin? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @template_major = admin_or_business? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
@ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) @ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
@is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id) @is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id)
end end
@ -596,7 +596,7 @@ class EcCoursesController < ApplicationController
def find_year def find_year
@year = EcYear.find(params[:ec_year_id]) @year = EcYear.find(params[:ec_year_id])
@ec_major_school = @year.ec_major_school @ec_major_school = @year.ec_major_school
@template_major = User.current.admin? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @template_major = admin_or_business? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) ||
@ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) @ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
#@is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id) #@is_manager = @template_major || @ec_course.ec_course_users.pluck(:user_id).include?(User.current.id)
end end

@ -34,7 +34,7 @@ class EcGraduationRequirementsController < ApplicationController
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
@year = EcYear.find params[:year_id] @year = EcYear.find params[:year_id]
position = @year.ec_graduation_requirements ? @year.ec_graduation_requirements.count + 1 : 1 position = @year.ec_graduation_requirements ? @year.ec_graduation_requirements.count + 1 : 1
@template_major = User.current.admin? || @year.ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) @template_major = admin_or_business? || @year.ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id)
ec_requirement_id = EcGraduationRequirement.create(content: params[:requirement], :ec_year_id => @year.id, :position => position) ec_requirement_id = EcGraduationRequirement.create(content: params[:requirement], :ec_year_id => @year.id, :position => position)
params[:subitems].try(:each_with_index) do |sub, index| params[:subitems].try(:each_with_index) do |sub, index|
EcGraduationSubitem.create(content: sub, ec_graduation_requirement_id: ec_requirement_id.id, position: index+1) EcGraduationSubitem.create(content: sub, ec_graduation_requirement_id: ec_requirement_id.id, position: index+1)
@ -48,7 +48,7 @@ class EcGraduationRequirementsController < ApplicationController
def update def update
requirement = EcGraduationRequirement.find params[:id] requirement = EcGraduationRequirement.find params[:id]
@year = requirement.ec_year @year = requirement.ec_year
@template_major = User.current.admin? || @year.ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) @template_major = admin_or_business? || @year.ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id)
requirement.update_attribute(:content, params[:requirement]) requirement.update_attribute(:content, params[:requirement])
requirement.ec_graduation_subitems.destroy_all requirement.ec_graduation_subitems.destroy_all
params[:subitems].try(:each_with_index) do |sub, index| params[:subitems].try(:each_with_index) do |sub, index|

@ -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
# 职业认证的权限判断 # 职业认证的权限判断

@ -25,7 +25,7 @@ class EcYearsController < ApplicationController
@status = 1 @status = 1
end end
@major_manager = true @major_manager = true
@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 ? "立即配置" : "查看")
@years = EcYear.where(:ec_major_school_id => @major_school.id) @years = EcYear.where(:ec_major_school_id => @major_school.id)
@years = paginateHelper @years, 10 @years = paginateHelper @years, 10
@ -338,7 +338,7 @@ class EcYearsController < ApplicationController
@ec_major_school = EcMajorSchool.find(params[:ec_major_school_id]) @ec_major_school = EcMajorSchool.find(params[:ec_major_school_id])
@year = EcYear.find(params[:id]) @year = EcYear.find(params[:id])
# 专业管理员身份 # 专业管理员身份
@template_major = User.current.admin? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id) @template_major = admin_or_business? || @ec_major_school.school.ec_school_users.pluck(:user_id).include?(User.current.id) || @ec_major_school.ec_major_school_users.pluck(:user_id).include?(User.current.id)
end end
# 职业认证的权限判断 # 职业认证的权限判断

@ -7,7 +7,7 @@ class EcsController < ApplicationController
def department def department
@template_major = EcMajorSchool.where(:template_major => true).first @template_major = EcMajorSchool.where(:template_major => true).first
@school_managers = @school.users @school_managers = @school.users
@is_school_manager = User.current.admin? || @school.users.where(:id => User.current.id).count > 0 # 学校管理员 @is_school_manager = User.current.admin? || User.current.business? || @school.users.where(:id => User.current.id).count > 0 # 学校管理员
@major_schools = @school.ec_major_schools.where(:template_major => false) @major_schools = @school.ec_major_schools.where(:template_major => false)
unless @is_school_manager unless @is_school_manager
@ -70,7 +70,7 @@ class EcsController < ApplicationController
end end
def school_manager def school_manager
unless User.current.admin? || @school.users.where(:id => User.current.id).count > 0 unless User.current.admin? || User.current.business? || @school.users.where(:id => User.current.id).count > 0
render_403 render_403
end end
end end

@ -2,11 +2,10 @@
class ManagementsController < ApplicationController class ManagementsController < ApplicationController
before_filter :require_business before_filter :require_business
before_filter :require_admin, :only => [:shixun_setting_list, :mirror_repository, :mirror_picture_shixuns, :editmd_template, before_filter :require_admin, :only => [:shixun_setting_list, :mirror_repository, :mirror_picture_shixuns, :editmd_template,
:editmd_template, :subject_level_system, :subject_setting_list, :auto_users_trial, :editmd_template, :subject_level_system, :subject_setting_list,
:evaluate_records, :identity_authentication, :identity_authentication, :professional_authentication, :shixun_authorization, :ec_template, :codemirror_template,
:shixun_authorization, :graduation_standard, :ec_template, :codemirror_template,
:course_guide_template, :shixun_quality_score, :tech_system, :update_notice, :setting_banner, :course_guide_template, :shixun_quality_score, :tech_system, :update_notice, :setting_banner,
:training_2018] :training_2018, :create_standard]
layout 'base_management' layout 'base_management'
include ManagementsHelper include ManagementsHelper
include SortHelper include SortHelper

@ -49,7 +49,7 @@
<!--</span>--> <!--</span>-->
</span> </span>
<span class="column-2 fr edu-txt-center"> <span class="column-2 fr edu-txt-center">
<% if @major_manager && !@major_school.template_major || User.current.admin? %> <% if @major_manager && !@major_school.template_major || User.current.admin? || User.current.business? %>
<a href="javascript:void(0);" onclick="delete_confirm_box_3('<%= ec_major_school_ec_year_path(year, :ec_major_school_id => @major_school) %>','您确定要删除吗?')" class="mr15 color-grey-c">删除</a> <a href="javascript:void(0);" onclick="delete_confirm_box_3('<%= ec_major_school_ec_year_path(year, :ec_major_school_id => @major_school) %>','您确定要删除吗?')" class="mr15 color-grey-c">删除</a>
<% end %> <% end %>
<%#= link_to '删除', ec_major_school_ec_year_path(year, :ec_major_school_id => @major_school), method: :delete, :class => "mr15 color-grey-c", data: { confirm: '您确定要删除吗' } %> <%#= link_to '删除', ec_major_school_ec_year_path(year, :ec_major_school_id => @major_school), method: :delete, :class => "mr15 color-grey-c", data: { confirm: '您确定要删除吗' } %>

@ -8,7 +8,7 @@
<li class="fl"> <li class="fl">
<p class="font-18 clearfix"> <p class="font-18 clearfix">
<span class="fl"><%= @major.name %></span> <span class="fl"><%= @major.name %></span>
<% if @major.schools && User.current.admin? %> <% if @major.schools && (User.current.admin? || User.current.business?) %>
<i class="iconfont icon-youjiantou font-14 newxiajiantou fl ml20" ></i> <i class="iconfont icon-youjiantou font-14 newxiajiantou fl ml20" ></i>
<ul class="edu-menu-list" id="ecmajorschools"> <ul class="edu-menu-list" id="ecmajorschools">
<% @major.schools.each do |school| %> <% @major.schools.each do |school| %>

@ -17,7 +17,7 @@
<ul> <ul>
<% @ec_courses.each_with_index do |course, index| %> <% @ec_courses.each_with_index do |course, index| %>
<% course_manager = course.ec_course_users.pluck(:user_id).include?(User.current.id) %> <% course_manager = course.ec_course_users.pluck(:user_id).include?(User.current.id) %>
<% btn_text = ((@ec_major_school.template_major && User.current.admin?) || (!@ec_major_school.template_major && @template_major) || course_manager) ? "立即配置" : "查看" %> <% btn_text = ((@ec_major_school.template_major && (User.current.admin? || User.current.business?)) || (!@ec_major_school.template_major && @template_major) || course_manager) ? "立即配置" : "查看" %>
<li class="clearfix"> <li class="clearfix">
<span class="column-No"><%= index + 1 %></span> <span class="column-No"><%= index + 1 %></span>
<span class="column-9"><%= course.name %></span> <span class="column-9"><%= course.name %></span>

@ -1,16 +1,18 @@
<div class="edu-back-white mt20 padding20"> <div class="edu-back-white mt20 padding20">
<p class="clearfix"><span class="font-16 fl">毕业要求通用标准</span><span class="ml5 btn-cir btn-cir-grey mt6 fl" id="standard_count"><%= @standards.count %></span></p> <p class="clearfix"><span class="font-16 fl">毕业要求通用标准</span><span class="ml5 btn-cir btn-cir-grey mt6 fl" id="standard_count"><%= @standards.count %></span></p>
<p class="clearfix mb10"><a href="javascript:void(0)" class="fr white-btn edu-greenback-btn" id="addBtn" show="0" onclick="addStandardPanel(this);">+ 新增</a></p> <% if User.current.admin? %>
<div class="padding20 clearfix edu-back-greyf5 mb15 none" id="addStandardPanel"> <p class="clearfix mb10"><a href="javascript:void(0)" class="fr white-btn edu-greenback-btn" id="addBtn" show="0" onclick="addStandardPanel(this);">+ 新增</a></p>
<p class="clearfix df mb15"> <div class="padding20 clearfix edu-back-greyf5 mb15 none" id="addStandardPanel">
<span class="fl color-red mt3">*</span><span class="mr15">1</span> <p class="clearfix df mb15">
<textarea class="input-flex-30" name="content" placeholder=""></textarea> <span class="fl color-red mt3">*</span><span class="mr15">1</span>
</p> <textarea class="input-flex-30" name="content" placeholder=""></textarea>
<p class="edu-txt-right"> </p>
<a href="javascript:void(0);" class="task-btn mr20" onclick="cancelAdd();">取消</a> <p class="edu-txt-right">
<a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="submit_data()">保存</a> <a href="javascript:void(0);" class="task-btn mr20" onclick="cancelAdd();">取消</a>
</p> <a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="submit_data()">保存</a>
</div> </p>
</div>
<% end %>
<input type="hidden" name="standard_id" value="-1"> <input type="hidden" name="standard_id" value="-1">
<div> <div>
<table class="edu-pop-table interval-td interval-all edu-txt-left" cellpadding="0" cellspacing="0" style="border-bottom: none;"> <table class="edu-pop-table interval-td interval-all edu-txt-left" cellpadding="0" cellspacing="0" style="border-bottom: none;">

@ -11,6 +11,7 @@
<span class="mr5" style="margin-right: 24px;">线下支付</span> <span class="mr5" style="margin-right: 24px;">线下支付</span>
<i class="iconfont icon-gengduo1 rightArrow" style="color: #323232;right: 4px"></i> <i class="iconfont icon-gengduo1 rightArrow" style="color: #323232;right: 4px"></i>
</p> </p>
<p class="payTip" style="margin-top:0px;margin-bottom:9px;">微信支付将于6月18日开通</p>
<!-- <div class="<%#= @training.training_payinfo.pay_type.to_i == 3 ? "" : "none" %> mt5" id="payInfos">--> <!-- <div class="<%#= @training.training_payinfo.pay_type.to_i == 3 ? "" : "none" %> mt5" id="payInfos">-->
<div class="mt5" id="payInfos"> <div class="mt5" id="payInfos">
<div class="payInfo df"> <div class="payInfo df">

Loading…
Cancel
Save