班级学生列表:“未分班”列表对成员分班,成员显示未自动刷新;具体分班列表对成员编辑分班,分班成员数统计未自动刷新

This commit is contained in:
cxt 2016-11-15 10:34:14 +08:00
parent 79b6a99324
commit d8906db1aa
3 changed files with 19 additions and 15 deletions

View File

@ -303,18 +303,21 @@ class CoursesController < ApplicationController
@member = Member.where(:course_id => @course.id, :user_id => params[:user_id]).first
@member.course_group_id = params[:course_group_id].to_i
@member.save
if params[:group_id] && params[:group_id] != "-1"
@group = CourseGroup.find params[:group_id]
results = student_homework_score(@group.id,0,0,"desc")
@limit = 50
@page = params[:page].nil? ? 1 : params['page'].to_i
@members_count = results.count
@mem_pages = Paginator.new @members_count, @limit, @page
@results = paginateHelper results, @limit
else
@course_groups = @course.course_groups
@no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count
if params[:group_id] != "0"
if params[:group_id] == "-1"
@group = "-1"
else
@group = CourseGroup.find params[:group_id]
end
# results = student_homework_score(@group.id,0,0,"desc")
# @limit = 50
# @page = params[:page].nil? ? 1 : params['page'].to_i
# @members_count = results.count
# @mem_pages = Paginator.new @members_count, @limit, @page
# @results = paginateHelper results, @limit
end
@course_groups = @course.course_groups
@no_group_count = @course.student.count - @course.members.where("course_group_id != 0").count
@canShowCode = isCourseTeacher(User.current.id,@course)
respond_to do |format|
format.js

View File

@ -120,7 +120,7 @@
<% if @course.course_groups.empty? %>
<%=member.course_group_id == 0 ? "暂无" : member.course_group.name %>
<% else %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id, :group_id => @group && @group != -1 ? @group.id : -1},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id, :group_id => @group && @group != -1 ? @group.id : (@group && @group == -1 ? -1 : 0)},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<div class="select-class-option">
<span class="hidden" style="display:inline-block; vertical-align:middle; max-width:70px;"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
<a href="javascript:void(0)" class="sy_icons_edit pic_edit_icon" alt="编辑" style="background-position:0 5px;"></a>

View File

@ -1,8 +1,9 @@
<% if @group %>
<% if params[:group_id] != "0" %>
$("#member_li_<%=@member.id %>").html("");
<% end %>
<% if @group && @group != "-1" %>
//$("#member_content").html("<%#= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>");
$("#join_or_add").html("<%= escape_javascript( render :partial => 'join_or_add')%>");
<% else %>
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
<% end %>
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");
$("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>");