权限调整

dev_shixuns
cxt 6 years ago
parent 97179ce628
commit eab8ccec8b

@ -2,6 +2,7 @@
class EcCourseAchievementMethodsController < ApplicationController class EcCourseAchievementMethodsController < ApplicationController
before_filter :find_target, :only => [:edit_course_target, :create_evaluation_methods] before_filter :find_target, :only => [:edit_course_target, :create_evaluation_methods]
skip_before_filter :verify_authenticity_token, :only => [:create_evaluation_methods, :sync_course_data] skip_before_filter :verify_authenticity_token, :only => [:create_evaluation_methods, :sync_course_data]
before_filter :find_ec_course, :only => [:index]
include ApplicationHelper include ApplicationHelper
@ -59,11 +60,9 @@ class EcCourseAchievementMethodsController < ApplicationController
############################################################### ###############################################################
def index def index
achievement_list = [] achievement_list = []
# 具体工程课程
ec_course = EcCourse.find params[:ec_course_id]
# 课程的所有目标 # 课程的所有目标
targets = ec_course.ec_course_targets targets = @ec_course.ec_course_targets
targets.each do |target| targets.each do |target|
evaluate_data = [] evaluate_data = []
# 评价环节 # 评价环节
@ -95,7 +94,7 @@ class EcCourseAchievementMethodsController < ApplicationController
end end
achievement_list << {target_id: target.id, target_evaluate_data: evaluate_data} achievement_list << {target_id: target.id, target_evaluate_data: evaluate_data}
end end
render :json => {achievement_list: achievement_list} render :json => {achievement_list: achievement_list, is_manager: @is_manager}
end end
@ -306,4 +305,13 @@ class EcCourseAchievementMethodsController < ApplicationController
@target = EcCourseTarget.find params[:ec_course_target_id] @target = EcCourseTarget.find params[:ec_course_target_id]
end end
def find_ec_course
@ec_course = EcCourse.find(params[:ec_course_id])
@year = @ec_course.ec_year
@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) ||
@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)
end
end end

@ -47,6 +47,8 @@ class EcCourseSupportsController < ApplicationController
course_support_data = [] course_support_data = []
max_support_count = 0 max_support_count = 0
subitems_count = 0 subitems_count = 0
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)
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
@ -74,7 +76,8 @@ class EcCourseSupportsController < ApplicationController
subitems_url: "#{graduation_requirement_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}", subitems_url: "#{graduation_requirement_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}",
course_count: @year.ec_courses.count, course_count: @year.ec_courses.count,
course_url: "#{ec_course_setting_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}", course_url: "#{ec_course_setting_ec_major_school_ec_year_path(@year, :ec_major_school_id => @year.ec_major_school_id)}",
max_support_count: max_support_count} max_support_count: max_support_count,
is_manager: is_manager}
end end
# 毕业要求vs课程体系 详情页面 # 毕业要求vs课程体系 详情页面

@ -429,7 +429,7 @@ class EcCoursesController < ApplicationController
{score: 70, level: ""}, {score: 70, level: ""},
{score: 60, level: ""}] {score: 60, level: ""}]
end end
render :json => {levels: ls} render :json => {levels: ls, is_manager: @is_manager}
} }
end end
end end

@ -26,7 +26,7 @@
<% end %> <% end %>
</li> </li>
<% end %> <% end %>
<% else %> <% elsif @template_major %>
<form id="form_data_for_requirements"> <form id="form_data_for_requirements">
<div class="clearfix ml30 mr30 pt20 pb20 bor-top-greyE" id="requirementNew"> <div class="clearfix ml30 mr30 pt20 pb20 bor-top-greyE" id="requirementNew">
<p class="df mb20"><input type="hidden" name="year_id" value="<%= @year.id %>"> <p class="df mb20"><input type="hidden" name="year_id" value="<%= @year.id %>">

@ -13,7 +13,7 @@
</li> </li>
<% end %> <% end %>
</ul> </ul>
<% elsif @ec_training_objective.present? %> <% elsif @ec_training_objective.present? && @template_major && @ec_training_objective && @sub_training_objectives.count > 0 %>
<form id="edit_training_subitems"> <form id="edit_training_subitems">
<ul class="edu-back-white padding10-30" id="SubentryNewPanel"> <ul class="edu-back-white padding10-30" id="SubentryNewPanel">
<li class="df mb10"> <li class="df mb10">

@ -12,7 +12,7 @@
<a href="javascript:void(0)" class="defalutCancelbtn mr20 fr" onclick="CancelEditBtn();">取消</a> <a href="javascript:void(0)" class="defalutCancelbtn mr20 fr" onclick="CancelEditBtn();">取消</a>
</p> </p>
</div> </div>
<% else %> <% elsif @template_major && @ec_training_objective && @sub_training_objectives.count > 0 %>
<div class="clearfix" id="targetEdit"> <div class="clearfix" id="targetEdit">
<textarea class="winput-100-130 mb10" id="training_obejctive"></textarea> <textarea class="winput-100-130 mb10" id="training_obejctive"></textarea>
<p class="clearfix"> <p class="clearfix">

Loading…
Cancel
Save