From 80401154bc1205e0d238c5d3f2e80ad238fbe77e Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 12 Jan 2017 14:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=8F=AD=E6=B7=BB=E5=8A=A0=E6=88=90?= =?UTF-8?q?=E5=91=98=E7=9A=84=E5=BC=B9=E6=A1=86=E6=A0=B7=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E3=80=81=E5=88=97=E8=A1=A8=E6=88=90=E5=91=98=E6=8C=89?= =?UTF-8?q?=E5=AD=A6=E5=8F=B7=E5=8D=87=E5=BA=8F=E6=8E=92=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 14 +++---- app/views/courses/_add_members.html.erb | 42 ++++++++++++------- .../courses/search_not_group_member.js.erb | 2 +- 3 files changed, 33 insertions(+), 25 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 854b34f87..2ad7d71c1 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -351,19 +351,17 @@ class CoursesController < ApplicationController @search = params[:search] q = params[:search] ? "#{params[:search].strip}" : "" @members = [] + @members = @course.members.where("course_group_id = 0").joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id asc").select{|m| m.roles.to_s.include?("Student")} if q.nil? || q == "" - @course.members.includes(:user =>[:user_extensions =>[]]).where("course_group_id = 0").each do |m| - if m && m.user && m.user.join_in?(@course) - @members << m - end - end else - @course.members.includes(:user =>[:user_extensions =>[]]).where("course_group_id = 0").each do |m| + members = [] + @members.each do |m| username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase - if m && m.user && m.user.join_in?(@course) && (m.user[:login].to_s.downcase.include?(q) || m.user.user_extensions[:student_id].to_s.downcase.include?(q) || username.include?(q)) - @members << m + if m && m.user && (m.user[:login].to_s.downcase.include?(q) || m.user.user_extensions[:student_id].to_s.downcase.include?(q) || username.include?(q)) + members << m end end + @members = members end @is_search = params[:is_search] ? 1 : 0 respond_to do |format| diff --git a/app/views/courses/_add_members.html.erb b/app/views/courses/_add_members.html.erb index 232587af8..4a949d90b 100644 --- a/app/views/courses/_add_members.html.erb +++ b/app/views/courses/_add_members.html.erb @@ -1,21 +1,31 @@ -
选择成员加入分班
-
- -
- <%= form_tag(add_members_course_path(@course, :group_id => @group.id), method: 'post',:class => "f_l",:id => "add_group_members") do %> -
- <%=render :partial => 'search_member_list', :locals => {:members => members} %> -
- <% end %> -
- -
- - +
+
+

添加成员

+
-
- +
+
选择成员加入分班
+
+ +
+ <%= form_tag(add_members_course_path(@course, :group_id => @group.id), method: 'post',:class => "",:id => "add_group_members") do %> +
+ <%=render :partial => 'search_member_list', :locals => {:members => members} %> +
+ <% end %> +
+ +
+
+ 确定 + 取消 +
+
+
+
+
+