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

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

View File

@ -120,7 +120,7 @@
<% if @course.course_groups.empty? %> <% if @course.course_groups.empty? %>
<%=member.course_group_id == 0 ? "暂无" : member.course_group.name %> <%=member.course_group_id == 0 ? "暂无" : member.course_group.name %>
<% else %> <% 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"> <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> <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> <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(""); $("#member_li_<%=@member.id %>").html("");
<% end %>
<% if @group && @group != "-1" %>
//$("#member_content").html("<%#= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>"); //$("#member_content").html("<%#= escape_javascript( render :partial => 'new_member_list', :locals => {:members => @results})%>");
$("#join_or_add").html("<%= escape_javascript( render :partial => 'join_or_add')%>"); $("#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 %> <% 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})%>"); $("#group_children_list").html("<%= escape_javascript( render :partial => 'layouts/group_children_list', :locals => {:course => @course})%>");