diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 6b3097d43..0b3f88d68 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -202,7 +202,7 @@ class CoursesController < ApplicationController group.course_id = @course.id group.save end - @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' @is_remote = true @course_groups = @course.course_groups @@ -236,17 +236,26 @@ class CoursesController < ApplicationController valid_attr = params[:valid] valid_value = params[:value] - - faker = CourseGroup.new + group_id = params[:group_id] + # faker = CourseGroup.new if valid_attr.eql?('name') - faker.name = valid_value - faker.course_id = params[:course_id] - faker.valid? - req[:valid] = faker.errors[:name].blank? - req[:message] = faker.errors[:name] + course = Course.find params[:course_id] + group_names = course.course_groups.map{|group| group.name unless group.id.to_s == group_id}.select{|group| !group.nil?} + if group_names.include?(valid_value) + req[:valid] = false + req[:message] = l(:modal_valid_unpassing) + else + req[:valid] = true + req[:message] = l(:modal_valid_passing) + end + # faker.name = valid_value + # faker.course_id = params[:course_id] + # faker.valid? + # req[:valid] = faker.errors[:name].blank? + # req[:message] = faker.errors[:name] end - req[:message] = l(:modal_valid_passing) if req[:message].blank? + # req[:message] = l(:modal_valid_passing) if req[:message].blank? render :json => req end def join_group @@ -274,7 +283,7 @@ class CoursesController < ApplicationController end def searchgroupmembers @subPage_title = l :label_student_list - @render_file = 'member_list' + @render_file = 'new_member_list' @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' @is_remote = true @score_sort_by = "desc" @@ -293,7 +302,7 @@ class CoursesController < ApplicationController ## 有角色参数的才是课程,没有的就是项目 if (User.current.admin? || @course.is_public == 1 || (@course.is_public == 0 && User.current.member_of_course?(@course))) - @render_file = 'member_list' + @render_file = 'new_member_list' @score_sort_by = "desc" @canShowCode = User.current.allowed_to?(:as_teacher,@course) && params[:role] != '1' @role = params[:role].nil? ? '2':params[:role] @@ -337,7 +346,7 @@ class CoursesController < ApplicationController def member_score_sort @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' @subPage_title = l :label_student_list - @render_file = 'member_list' + @render_file = 'new_member_list' @is_remote = true @score_sort_by = params[:sort_by] if params[:sort_by] @search_name = params[:search_name] if params[:search_name] @@ -842,7 +851,7 @@ class CoursesController < ApplicationController #当加入,退出分班时查询分班的学生 def search_group_members group @subPage_title = l :label_student_list - @render_file = 'member_list' + @render_file = 'new_member_list' @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' @is_remote = true @score_sort_by = "desc" diff --git a/app/views/courses/_course_student.html.erb b/app/views/courses/_course_student.html.erb index e95e1d901..8da3987a8 100644 --- a/app/views/courses/_course_student.html.erb +++ b/app/views/courses/_course_student.html.erb @@ -1,20 +1,10 @@
-