增减功能《课程分班模块添加当分班中没有学生时,可以删除该分班》

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2014-12-08 16:50:20 +08:00
parent e6efa0f483
commit 5c33c578bb
6 changed files with 21 additions and 1 deletions

View File

@ -226,6 +226,16 @@ class CoursesController < ApplicationController
@course_groups = @course.course_groups @course_groups = @course.course_groups
end 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 def updategroupname
@subPage_title = l :label_student_list @subPage_title = l :label_student_list
if params[:group_name] if params[:group_name]

View File

@ -48,6 +48,13 @@
<li class="classbox" id="group_name_<%= group.id %>" name="check_group_name"> <li class="classbox" id="group_name_<%= group.id %>" name="check_group_name">
<%= link_to group_display, searchgroupmembers_course_path(@course,:group_id => group.id), method: 'get', remote: true, <%= 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;"%> :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 %> <% if @canShowCode %>
<a href="javascript:void(0)" class="f_l" onclick="$('#add_tag_<%= group.id %>').slideToggle();"><img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" /></a> <a href="javascript:void(0)" class="f_l" onclick="$('#add_tag_<%= group.id %>').slideToggle();"><img src="/images/pic_edit.png" width="14" height="15" alt="编辑班级" /></a>
<% end %> <% end %>

View File

@ -0,0 +1 @@
$("#st_groups").html("<%= escape_javascript( render :partial => 'groups_name', locals: {:course_groups => @course_groups})%>");

View File

@ -572,6 +572,7 @@ zh:
label_member: 成员 label_member: 成员
label_search_member_count: 共搜索到 label_search_member_count: 共搜索到
label_member_people: label_member_people:
label_delete_group: 确定删除分班?
label_current_group: 当前分班 label_current_group: 当前分班
label_limit_groupname: 组别名不能超出20字符 label_limit_groupname: 组别名不能超出20字符
label_limit_groupname_null: 组别名不能为空 label_limit_groupname_null: 组别名不能为空

View File

@ -646,7 +646,8 @@ RedmineApp::Application.routes.draw do
match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get] match "searchmembers", :controller => 'courses', :action => 'searchmembers', :via => [:post,:get]
match "searchgroupmembers", :via => [:post, :get] match "searchgroupmembers", :via => [:post, :get]
match "updategroupname", :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' post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
delete 'join_in/join_group', :to => 'courses#unjoin_group' delete 'join_in/join_group', :to => 'courses#unjoin_group'
end end

BIN
public/images/pic_del.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B