From 9d0e39e708a602a17ffcb2db50a3c1c8690faccb Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Fri, 5 Dec 2014 16:03:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=99=E6=B6=9B=E6=8F=90?= =?UTF-8?q?=E5=87=BA=E7=9A=84bug=20Signed-off-by:=20alan=20<547533434@qq.c?= =?UTF-8?q?om>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 13 ++++++---- app/models/course_group.rb | 2 +- app/views/courses/_groups_name.html.erb | 32 +++++++++++++++++++++---- app/views/courses/_member_list.html.erb | 2 +- config/locales/zh.yml | 2 ++ 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index d266f5990..b89c407a3 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -217,6 +217,10 @@ class CoursesController < ApplicationController group.course_id = @course.id group.save end + @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' + @is_remote = true + @members = searchStudent(@course) + @membercount = @members.count @course_groups = @course.course_groups end @@ -229,6 +233,8 @@ class CoursesController < ApplicationController @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1' @is_remote = true @course_groups = @course.course_groups + @members = searchStudent(@course) + @membercount = @members.count end def join_group group = CourseGroup.find(params[:object_id]) @@ -283,11 +289,8 @@ class CoursesController < ApplicationController @members = searchTeacherAndAssistant(@course) when '2' @subPage_title = l :label_student_list - if @course_group_id - @members = search_student_in_group(@course, @course_group_id) - else - @members = searchStudent(@course) - end + @members = searchStudent(@course) + @membercount = @members.count else @subPage_title = '' @members = @course.member_principals.includes(:roles, :principal).all.sort diff --git a/app/models/course_group.rb b/app/models/course_group.rb index 6126352f6..c5c2f5c85 100644 --- a/app/models/course_group.rb +++ b/app/models/course_group.rb @@ -12,7 +12,7 @@ class CourseGroup < ActiveRecord::Base before_destroy :set_member_nil attr_accessible :name - + validates :name, :presence => true, :length => {:maximum => 20}, :uniqueness => true def set_member_nil if self.members && self.members.count > 0 self.members.update_all("course_group_id = 0") diff --git a/app/views/courses/_groups_name.html.erb b/app/views/courses/_groups_name.html.erb index 151eb9c7e..479bf27a5 100644 --- a/app/views/courses/_groups_name.html.erb +++ b/app/views/courses/_groups_name.html.erb @@ -1,4 +1,28 @@ +"