diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index a14ade71a..326ae0f42 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -205,7 +205,12 @@ class CoursesController < ApplicationController
@is_remote = true
q = "#{params[:name].strip}"
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
- @results = searchStudent_by_name(@course, q)
+ if params[:incourse]
+ @results = searchStudent_by_name(@course, q)
+ elsif params[:ingroup]
+ @group = CourseGroup.find(params[:search_group_id])
+ @results = searchgroupstudent_by_name(@group, @course, q)
+ end
@result_count = @results.count
@results = paginateHelper @results
@@ -226,6 +231,16 @@ class CoursesController < ApplicationController
@course_groups = @course.course_groups
end
+ def deletegroup
+ CourseGroup.delete(params[:group_id])
+ @subPage_title = l :label_student_list
+ @canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
+ @is_remote = true
+ @members = searchStudent(@course)
+ @membercount = @members.count
+ @course_groups = @course.course_groups
+ end
+
def updategroupname
@subPage_title = l :label_student_list
if params[:group_name]
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 3b7e811f6..a1199a55a 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -184,6 +184,18 @@ module CoursesHelper
end
members
end
+ def searchgroupstudent_by_name(group, project, name)
+ members = []
+ group.members.each do |m|
+ if m && m.user && m.user.allowed_to?(:as_student,project)
+ username = m.user[:lastname].to_s + m.user[:firstname].to_s
+ if(m.user[:login].to_s.include?(name) || m.user.user_extensions[:student_id].to_s.include?(name) || username.include?(name))
+ members << m
+ end
+ end
+ end
+ members
+ end
def searchStudent_by_group group, project
#searchPeopleByRoles(project, StudentRoles)
members = []
diff --git a/app/views/courses/_groups_name.html.erb b/app/views/courses/_groups_name.html.erb
index 096e84372..ca0fed9c2 100644
--- a/app/views/courses/_groups_name.html.erb
+++ b/app/views/courses/_groups_name.html.erb
@@ -1,40 +1,4 @@
-
@@ -48,6 +12,13 @@
-
<%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true,
:onclick => "checkclass('group_name_#{group.id}')",:style => " border:0px; color: #0d90c3; float:left;"%>
+ <% if @canShowCode && group.members.count == 0 %>
+ <%= link_to '', deletegroup_course_path(:group_id => group.id), :method => 'delete', :remote => true,
+ :data => {confirm: l(:label_delete_group)},
+ :class => 'f_1',
+ :style => "width: 16px;height: 21px;margin-top:3px;margin-left:5px;background: url(/images/pic_del.gif) no-repeat 0 0;"
+ %>
+ <% end %>
<% if @canShowCode %>
<% end %>
diff --git a/app/views/courses/_member_list.html.erb b/app/views/courses/_member_list.html.erb
index c707487a7..cdea592b4 100644
--- a/app/views/courses/_member_list.html.erb
+++ b/app/views/courses/_member_list.html.erb
@@ -6,9 +6,14 @@
<%= l(:label_current_group)%>: <%= @group.name %>
<% end %>
<% if @subPage_title && @subPage_title == l(:label_student_list)%>
+ <% if @subPage_title == l(:label_student_list) %>
<%= form_tag( searchmembers_course_path(@course), method: 'get',:class => "f_l",:style => "margin-left: 5px; ",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 'f_1', :style => "height:15px"%>
- <%= submit_tag l(:label_search), :class => "f_2"%>
+ <% if @group %>
+ <%= hidden_field "search_group_id", params[:search_group_id],:value => "#{@group.id}", name: 'search_group_id' %>
+ <%= submit_tag l(:label_search_member_in_group), :name => "ingroup",:class => "f_2"%>
+ <% end %>
+ <%= submit_tag l(:label_search_member_in_course), :name => 'incourse',:onclick => "checkclass('group_name_0')",:class => "f_2"%>
<%#= link_to l(:label_search),'' , :class => 'f_2' %>
<% end %>
<% end %>
diff --git a/app/views/courses/deletegroup.js.erb b/app/views/courses/deletegroup.js.erb
new file mode 100644
index 000000000..a6f6933b9
--- /dev/null
+++ b/app/views/courses/deletegroup.js.erb
@@ -0,0 +1 @@
+$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");
\ No newline at end of file
diff --git a/app/views/courses/member.html.erb b/app/views/courses/member.html.erb
index fb317acf6..b426e4a3e 100644
--- a/app/views/courses/member.html.erb
+++ b/app/views/courses/member.html.erb
@@ -1,3 +1,40 @@
+
<%= stylesheet_link_tag 'course_group', :media => 'all' %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 156880f13..236af39c1 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -570,8 +570,11 @@ zh:
label_role_new: 新建角色
label_role_and_permissions: 角色和权限
label_member: 成员
+ label_search_member_in_group: 班内搜索
+ label_search_member_in_course: 课内搜索
label_search_member_count: 共搜索到
label_member_people: 人
+ label_delete_group: 确定删除分班?
label_current_group: 当前分班
label_limit_groupname: 组别名不能超出20字符
label_limit_groupname_null: 组别名不能为空
diff --git a/config/routes.rb b/config/routes.rb
index 835e6be6e..45f3071b3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -646,7 +646,8 @@ RedmineApp::Application.routes.draw do
match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get]
match "searchgroupmembers", :via => [:post, :get]
match "updategroupname", :via => [:post, :get]
- match "addgroups", :via => [:post, :get]
+ match "addgroups", :via => [:post, :get]
+ match 'deletegroup', :via => [:delete]
post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
delete 'join_in/join_group', :to => 'courses#unjoin_group'
end
diff --git a/public/images/pic_del.gif b/public/images/pic_del.gif
new file mode 100644
index 000000000..436fd1f92
Binary files /dev/null and b/public/images/pic_del.gif differ