只有全部列表中的学生可编辑分班

This commit is contained in:
cxt 2016-03-10 17:41:53 +08:00
parent 0d8052da28
commit a7b9d8424a
3 changed files with 10 additions and 4 deletions

View File

@ -242,9 +242,14 @@ class CoursesController < ApplicationController
end end
def teacher_assign_group def teacher_assign_group
member = Member.where(:course_id => @course.id, :user_id => User.current.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
@course_groups = @course.course_groups
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
respond_to do |format|
format.js
end
end end
def join_group def join_group

View File

@ -60,12 +60,12 @@
<% end%> <% end%>
</ul> </ul>
<% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %> <% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %>
<% if @course.course_groups.nil? %> <% if @course.course_groups.nil? || @group %>
<div class="select-class-option fl" style="margin-left: 105px;"> <div class="select-class-option fl" style="margin-left: 105px;">
<span style="width: 100px; text-align: center; float: left;" class="hidden">暂无</span> <span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
</div> </div>
<% else %> <% else %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id},: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},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<div class="select-class-option fl" style="margin-left: 105px;"><span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span> <div class="select-class-option fl" style="margin-left: 105px;"><span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2 ml5"></a> <a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2 ml5"></a>
</div> </div>

View File

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