分班添加成员的弹框样式修改、列表成员按学号升序排列

This commit is contained in:
cxt 2017-01-12 14:40:34 +08:00
parent ee4d676f11
commit 80401154bc
3 changed files with 33 additions and 25 deletions

View File

@ -351,19 +351,17 @@ class CoursesController < ApplicationController
@search = params[:search]
q = params[:search] ? "#{params[:search].strip}" : ""
@members = []
@members = @course.members.where("course_group_id = 0").joins("join user_extensions on members.user_id = user_extensions.user_id").order("student_id asc").select{|m| m.roles.to_s.include?("Student")}
if q.nil? || q == ""
@course.members.includes(:user =>[:user_extensions =>[]]).where("course_group_id = 0").each do |m|
if m && m.user && m.user.join_in?(@course)
@members << m
end
end
else
@course.members.includes(:user =>[:user_extensions =>[]]).where("course_group_id = 0").each do |m|
members = []
@members.each do |m|
username = m.user[:lastname].to_s.downcase + m.user[:firstname].to_s.downcase
if m && m.user && m.user.join_in?(@course) && (m.user[:login].to_s.downcase.include?(q) || m.user.user_extensions[:student_id].to_s.downcase.include?(q) || username.include?(q))
@members << m
if m && m.user && (m.user[:login].to_s.downcase.include?(q) || m.user.user_extensions[:student_id].to_s.downcase.include?(q) || username.include?(q))
members << m
end
end
@members = members
end
@is_search = params[:is_search] ? 1 : 0
respond_to do |format|

View File

@ -1,8 +1,15 @@
<div class="f14 fb fontGrey3 mb10">选择成员加入分班</div>
<div class="fl mr10">
<div id="muban_popup_box" style="width:400px;">
<div class="muban_popup_top">
<h3 class="fl">添加成员</h3>
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="muban_popup_con clear">
<div class="f14 fb fontGrey3 mb10 mt15 ml20">选择成员加入分班</div>
<div class="fl mr10 ml20 w350">
<input type="text" name="search" value="<%=@search %>" placeholder="输入学生登录名/姓名/学号进行搜索" class="subjectSearch" />
<div class="cl"></div>
<%= form_tag(add_members_course_path(@course, :group_id => @group.id), method: 'post',:class => "f_l",:id => "add_group_members") do %>
<%= form_tag(add_members_course_path(@course, :group_id => @group.id), method: 'post',:class => "",:id => "add_group_members") do %>
<div id="search_member_list">
<%=render :partial => 'search_member_list', :locals => {:members => members} %>
</div>
@ -10,12 +17,15 @@
<div class="cl"></div>
<span class="c_red none" id="add_members_notice"></span>
<div class="cl"></div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="submit_add_members_form();">确定</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
<div class="mt10">
<a href="javascript:void(0);" class="fl sy_btn_blue mr10" onclick="submit_add_members_form();">确定</a>
<a href="javascript:void(0);" class="fl sy_btn_grey" onclick="hideModal();">取消</a>
<div class="cl"></div>
</div>
</div>
<div class="cl"></div>
</div>
</div>
<script>
var lastSearchCondition = '';
var count = 0;

View File

@ -1,6 +1,6 @@
<% if @is_search == 0 %>
var htmlvalue = "<%= escape_javascript( render :partial => 'courses/add_members', :locals => {:members => @members} )%>";
pop_up_box(htmlvalue,400,30,50);
pop_box_new(htmlvalue,400,510);
<% else %>
$("#search_member_list").html("<%= escape_javascript(render :partial => 'search_member_list', :locals => {:members => @members}) %>");
<% end %>