班级配置-组织:如图取消关联,点击确定按钮,确认弹框不消失,且关联的组织列表未自动刷新

This commit is contained in:
cxt 2017-01-20 15:37:36 +08:00
parent 2851e52d9b
commit f24e7346a2
2 changed files with 11 additions and 1 deletions

View File

@ -16,5 +16,15 @@ class OrgCoursesController < ApplicationController
@course = Course.find(params[:course_id])
@org_course = OrgCourse.find(params[:id])
@org_course.destroy
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{@course.id}").map(&:organization_id)
if course_org_ids.empty?
@orgs_not_in_course = User.current.organizations
else
course_org_ids = "(" + course_org_ids.join(',') + ")"
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids}")
end
respond_to do |format|
format.js
end
end
end

View File

@ -60,7 +60,7 @@
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'courses', :action => 'search_public_orgs_not_in_course') %>'+'?page=1',
url: "/courses/<%=@course.id.to_s %>/search_public_orgs_not_in_course?page=1" ,
type:'get'
});
});