Merge branch 'dev_cs' into develop
This commit is contained in:
commit
3f3f3804ba
|
|
@ -1787,24 +1787,48 @@ class CoursesController < ApplicationController
|
|||
end
|
||||
|
||||
def search_not_teachers
|
||||
if !params[:search].nil?
|
||||
members = searchTeacherAndAssistant @course
|
||||
member_ids = "(" + members.map(&:user_id).join(',') + ")"
|
||||
condition = "%#{params[:search].strip}%".gsub(" ","")
|
||||
members = searchTeacherAndAssistant @course
|
||||
member_ids = "(" + members.map(&:user_id).join(',') + ")"
|
||||
condition = "%#{params[:search]}%".gsub(" ","")
|
||||
@school = params[:school] || @course.teacher.school_name
|
||||
if @school != ""
|
||||
school_s = "%#{@school}%".gsub(" ","")
|
||||
school_ids = School.where("name like '#{school_s}'").blank? ? "(-1)" : "(" + School.where("name like '#{school_s}'").map(&:id).join(",") + ")"
|
||||
@users = User.joins(:user_extensions).where("users.id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname)) LIKE '#{condition}' and user_extensions.school_id in #{school_ids}")
|
||||
else
|
||||
@users = User.where("id not in #{member_ids} and status = 1 and LOWER(concat(lastname, firstname)) LIKE '#{condition}'").includes(:user_extensions)
|
||||
end
|
||||
|
||||
@user_ids = @users.map(&:id).join(",")
|
||||
@limit = 8
|
||||
@page = params[:page].nil? ? 1 : params['page'].to_i
|
||||
@users_count = @users.count
|
||||
@users_pages = Paginator.new @users_count, @limit, @page
|
||||
@users = paginateHelper @users, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search_not_students
|
||||
if !params[:search].nil?
|
||||
members = @course.members.select{|m| m.roles.to_s.include?("Student")}
|
||||
member_ids = members.empty? ? "(-1)" : "(" + members.map(&:user_id).join(',') + ")"
|
||||
condition = "%#{params[:search].strip}%".gsub(" ","")
|
||||
members = @course.members.select{|m| m.roles.to_s.include?("Student")}
|
||||
member_ids = members.empty? ? "(-1)" : "(" + members.map(&:user_id).join(',') + ")"
|
||||
condition = "%#{params[:search]}%".gsub(" ","")
|
||||
@school = params[:school] || @course.teacher.school_name
|
||||
if @school != ""
|
||||
school_s = "%#{@school}%".gsub(" ","")
|
||||
school_ids = School.where("name like '#{school_s}'").blank? ? "(-1)" : "(" + School.where("name like '#{school_s}'").map(&:id).join(",") + ")"
|
||||
@users = User.joins(:user_extensions).where("users.id not in #{member_ids} and status = 1 and user_extensions.school_id in #{school_ids} and (LOWER(concat(lastname, firstname)) LIKE '#{condition}' or user_extensions.student_id LIKE '#{condition}')")
|
||||
else
|
||||
@users = User.joins(:user_extensions).where("users.id not in #{member_ids} and status = 1 and (LOWER(concat(lastname, firstname)) LIKE '#{condition}' or user_extensions.student_id LIKE '#{condition}')")
|
||||
end
|
||||
|
||||
@user_ids = @users.map(&:id).join(",")
|
||||
@limit = 8
|
||||
@page = params[:page].nil? ? 1 : params['page'].to_i
|
||||
@users_count = @users.count
|
||||
@users_pages = Paginator.new @users_count, @limit, @page
|
||||
@users = paginateHelper @users, @limit
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
|
|||
|
|
@ -241,9 +241,10 @@ class MembersController < ApplicationController
|
|||
@create_member_error_messages = "角色不能留空" unless params[:membership][:role_ids]
|
||||
@create_member_error_messages = "用户不能留空" unless params[:membership][:user_ids]
|
||||
|
||||
if params[:membership][:user_ids]
|
||||
#if params[:membership][:user_ids]
|
||||
if params[:choose_student_ids] && params[:membership]
|
||||
attrs = params[:membership].dup
|
||||
user_ids = attrs.delete(:user_ids)
|
||||
user_ids = params[:choose_student_ids].split(",")
|
||||
user_ids.each do |user_id|
|
||||
if @course.members.where(:user_id => user_id).empty?
|
||||
member = Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
<% if params[:is_observe] %>
|
||||
<% if params[:is_observe] || params[:page] %>
|
||||
<% unless params[:page] %>
|
||||
$("#choose_student_ids").val('');
|
||||
<% end %>
|
||||
$("#search_not_students_list").html("<%= j(render :partial => 'courses/settings/search_not_students_list') %>");
|
||||
<% else %>
|
||||
laststSearchCondition = '';
|
||||
var htmlvalue = "<%= j(render :partial => 'courses/settings/add_students') %>";
|
||||
pop_box_new(htmlvalue, 440, 490);
|
||||
pop_box_new(htmlvalue, 560, 600);
|
||||
<% end %>
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
<% if params[:is_observe] %>
|
||||
<% if params[:is_observe] || params[:page] %>
|
||||
<% unless params[:page] %>
|
||||
$("#choose_student_ids").val('');
|
||||
<% end %>
|
||||
$("#search_not_teachers_list").html("<%= j(render :partial => 'courses/settings/search_not_teachers_list') %>");
|
||||
<% else %>
|
||||
lastteSearchCondition = "";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<!-------------------添加学生--------------------------->
|
||||
<div class="task-popup newteacher" style="width:440px;">
|
||||
<div class="task-popup newteacher" style="width:560px;">
|
||||
<div class="task-popup-title clearfix task-popup-bggrey">
|
||||
<h3 class="fl ">添加学生</h3>
|
||||
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
|
|
@ -7,12 +7,12 @@
|
|||
<div class="task_popup_con">
|
||||
<div class="newupload_conbox clearfix">
|
||||
<%= form_tag url_for(course_memberships_path(@course)), :remote => true, :method => :post, :id => 'add_student_form' do |f| %>
|
||||
<div class="left fl" style="width:400px;">
|
||||
<div class="mb10 edu-position" style="width:400px;">
|
||||
<div class="left fl" style="width:520px;">
|
||||
<div class="mb10 edu-position" style="width:520px;">
|
||||
<input type="hidden" value="10" name="membership[role_ids][]">
|
||||
<input type="hidden" value="<%= @course.id %>" id="course_search_not_student_id">
|
||||
<input class="task-form-100 task-height-40 panel-box-sizing color-grey3" id="search_not_student" placeholder="输入姓名、学号进行搜索" type="text">
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5" onclick="search_not_student_f()"><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<div class="clearfix mb15">
|
||||
<% if @course.course_groups.count > 0 %>
|
||||
|
|
@ -21,23 +21,45 @@
|
|||
|
||||
<div class="mb10 edu-position" style="text-align: right">
|
||||
<label class="color-grey">单位: </label>
|
||||
<input placeholder="请输入单位名称" class="task-form-60 task-height-40 panel-box-sizing color-grey3"/>
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
|
||||
<input placeholder="请输入单位名称" value="<%= @school %>" id="search_not_student_school" class="task-form-60 task-height-40 panel-box-sizing color-grey3"/>
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5" onclick="search_not_student_f()"><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<ul class="upload_select_box fl" style="overflow-y:auto;width:380px;" id="search_not_students_list">
|
||||
<%#= render :partial => 'courses/settings/search_not_students_list' %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<input id="choose_student_ids" name="choose_student_ids" type="hidden" value="">
|
||||
|
||||
<div>
|
||||
<span class="color-orange fl none" id="add_student_notice"></span>
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" style="" onclick="submit_add_student_form()">确定</a>
|
||||
<a href="javascript:void(0);" class="pop_close task-btn fr mr10" style="">取消</a>
|
||||
<p style="width:520px;" class="ml10">
|
||||
<input id="all_student_select" type="checkbox" name="all_student_select" class="fl mt7 mr5 magic-checkbox" value="">
|
||||
<label for="all_student_select">
|
||||
<span class="span1 edu-name-dark edu-txt-w140 task-hide font-bd" style="text-align: center">姓名</span>
|
||||
<span class="span2 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">学号</span>
|
||||
<span class="span3 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">用户ID</span>
|
||||
</label>
|
||||
</p>
|
||||
<div class="fl" style="width:520px;" id="search_not_students_list">
|
||||
<%= render :partial => 'courses/settings/search_not_students_list' %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
$("#search_not_student, #search_not_student_school").on("keydown", function(event){
|
||||
var code;
|
||||
if (!event) {
|
||||
event = window.event; //针对ie浏览器
|
||||
code = event.keyCode;
|
||||
}
|
||||
else {
|
||||
code = event.keyCode;
|
||||
}
|
||||
if(code == 13) {
|
||||
search_not_student_f();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,27 +1,36 @@
|
|||
<!-------------------添加教师\助教--------------------------->
|
||||
<div class="task-popup newteacher" style="width:600px;">
|
||||
<div class="task-popup newteacher" style="width:688px;">
|
||||
<div class="task-popup-title clearfix task-popup-bggrey">
|
||||
<h3 class="fl ">添加教师/助教</h3>
|
||||
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
|
||||
</div>
|
||||
<div class="task_popup_con">
|
||||
<div class="newupload_conbox clearfix">
|
||||
<%= form_tag url_for(course_memberships_path(@course)), :remote => true, :method => :post, :id => 'add_teacher_form' do |f| %>
|
||||
<div class="left fl" style="width:415px;">
|
||||
<div class="mb10 edu-position" style="width:400px;">
|
||||
<%= form_tag url_for(course_memberships_path(@course)), :remote => true, :method => :post, :id => 'add_teacher_form' do |f| %>
|
||||
<div class="left fl" style="width:535px;">
|
||||
<div class="mb10 edu-position" style="width:520px;">
|
||||
<input type="hidden" value="<%= @course.id %>" id="course_search_not_teacher_id">
|
||||
<input class="task-form-100 task-height-40 panel-box-sizing" id="search_not_teacher" placeholder="输入用户的真实姓名进行搜索" type="text">
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5" onclick="search_not_teacher_f()"><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<div class="mb10 edu-position mr15" style="text-align: right">
|
||||
<label class="color-grey">单位: </label>
|
||||
<input placeholder="请输入单位名称" class="task-form-40 task-height-40 panel-box-sizing color-grey3"/>
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5"><i class="fa fa-search"></i></a>
|
||||
<input placeholder="请输入单位名称" value="<%= @school %>" id="search_not_teacher_school" class="task-form-60 task-height-40 panel-box-sizing color-grey3"/>
|
||||
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey mt5" onclick="search_not_teacher_f()"><i class="fa fa-search"></i></a>
|
||||
</div>
|
||||
<div class="clearfix mb15">
|
||||
<ul class="upload_select_box fl" style="overflow-y:auto;width:380px;" id="search_not_teachers_list">
|
||||
<%#= render :partial => 'courses/settings/search_not_teachers_list' %>
|
||||
</ul>
|
||||
<input id="choose_student_ids" name="choose_student_ids" type="hidden" value="">
|
||||
|
||||
<p style="width:520px;" class="ml10">
|
||||
<input id="all_student_select" type="checkbox" name="all_student_select" class="fl mt7 mr5 magic-checkbox" value="">
|
||||
<label for="all_student_select">
|
||||
<span class="span1 edu-name-dark edu-txt-w140 task-hide font-bd" style="text-align: center">姓名</span>
|
||||
<span class="span2 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">学号</span>
|
||||
<span class="span3 ml10 edu-txt-w140 task-hide font-bd" style="text-align: center">用户ID</span>
|
||||
</label>
|
||||
</p>
|
||||
|
||||
<div class="fl" style="width:520px;" id="search_not_teachers_list">
|
||||
<%= render :partial => 'courses/settings/search_not_teachers_list' %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -29,16 +38,12 @@
|
|||
<h4 class="font-16 mt95">角色:</h4>
|
||||
<ul class="pl20 pb20">
|
||||
<li>
|
||||
<!--<i class="fa fa-circle-o grey fl" aria-hidden="true"></i>-->
|
||||
<!--<i class="fa fa-dot-circle-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
|
||||
<label>
|
||||
<input id="role_9" type="radio" class="magic-radio" value="9" name="membership[role_ids][]">
|
||||
<label for="role_9">教师</label>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<!--<i class="fa fa-circle-o grey fl" aria-hidden="true"></i>-->
|
||||
<!--<i class="fa fa-dot-circle-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
|
||||
<label>
|
||||
<input id="role_7" class="magic-radio" type="radio" value="7" name="membership[role_ids][]">
|
||||
<label for="role_7">助教</label>
|
||||
|
|
@ -46,13 +51,29 @@
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
<a href="javascript:void(0);" class="pop_close task-btn mb10" style="margin-top: 122px;">取消</a>
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue" style="margin-top: 122px;" onclick="submit_add_teacher_form()">确定</a>
|
||||
<a href="javascript:void(0);" class="pop_close task-btn mb10" style="margin-top: 164px;">取消</a>
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue" style="margin-top: 164px;" onclick="submit_add_teacher_form()">确定</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<span class="color-orange fl none" id="add_teacher_notice"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
$("#search_not_teacher, #search_not_teacher_school").on("keydown", function(event){
|
||||
var code;
|
||||
if (!event) {
|
||||
event = window.event; //针对ie浏览器
|
||||
code = event.keyCode;
|
||||
}
|
||||
else {
|
||||
code = event.keyCode;
|
||||
}
|
||||
if(code == 13) {
|
||||
search_not_teacher_f();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,18 +1,79 @@
|
|||
<% unless @users.empty? %>
|
||||
<% @users.each do |user| %>
|
||||
<% if user && user.user_extensions %>
|
||||
<li class="clearfix">
|
||||
<!--<i class="fa fa-square-o grey fl" aria-hidden="true"></i>-->
|
||||
<!--<i class="fa fa-check-square-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
|
||||
<input id="add_student_<%= user.id %>" type="checkbox" class="fl mt7 mr5 magic-checkbox" name="membership[user_ids][]" value="<%= user.id %>">
|
||||
<label for="add_student_<%= user.id %>" style="top:0px">
|
||||
<a href="<%= user_path(user) %>" target="_blank" class="task-hide fl span1 edu-name-dark edu-txt-w100"><%= user.show_real_name %>(<%= user.login %>)</a>
|
||||
<span class="fl color-grey span2 ml10 task-hide" style="width: 56px"><%= user.identity %></span>
|
||||
<span class="span3 fl ml10 edu-txt-w140 task-hide" style="width: 161px"><%= user.user_extensions.school ? user.user_extensions.school.name : "" %></span>
|
||||
</label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
搜索结果为空
|
||||
<% end %>
|
||||
<ul class="upload_select_box fl mb10" style="overflow-y:auto;width:500px;">
|
||||
<% unless @users.empty? %>
|
||||
<% @users.each do |user| %>
|
||||
<% if user && user.user_extensions %>
|
||||
<li class="clearfix">
|
||||
<!--<i class="fa fa-square-o grey fl" aria-hidden="true"></i>-->
|
||||
<!--<i class="fa fa-check-square-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
|
||||
<input id="add_student_<%= user.id %>" type="checkbox" class="fl mt7 mr5 magic-checkbox" name="membership[user_ids][]" value="<%= user.id %>">
|
||||
<label for="add_student_<%= user.id %>" style="top:0px">
|
||||
<a href="<%= user_path(user) %>" target="_blank" class="task-hide span1 edu-name-dark edu-txt-w140"><%= user.show_real_name %>(<%= user.login %>)</a>
|
||||
<span class="span2 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.user_extensions.try(:student_id) %></span>
|
||||
<span class="span3 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.login %></span>
|
||||
</label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div class="clearfix">
|
||||
<div class="cl mb10">
|
||||
<span class="color-orange none" id="add_student_notice"></span>
|
||||
</div>
|
||||
|
||||
<div class="fl pages_little_show">
|
||||
<ul>
|
||||
<%= pagination_links_full @users_pages, @users_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<a href="javascript:void(0);" class="task-btn task-btn-blue fr" style="" onclick="submit_add_student_form()">确定</a>
|
||||
<a href="javascript:void(0);" class="pop_close task-btn fr mr10" onclick="hideModal();">取消</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
if($("#choose_student_ids").val() != ""){
|
||||
var choose_ids = $("#choose_student_ids").val().split(",");
|
||||
for (var i = 0; i < choose_ids.length; i++){
|
||||
$("#add_student_" + choose_ids[i]).attr("checked", "checked");
|
||||
}
|
||||
}
|
||||
|
||||
$("#all_student_select").on('change', function(){
|
||||
if($("#all_student_select").is(':checked')){
|
||||
$("#choose_student_ids").val("<%= @user_ids %>");
|
||||
$("input[name='membership[user_ids][]']").attr('checked', true);
|
||||
} else{
|
||||
$("#choose_student_ids").val("");
|
||||
$("input[name='membership[user_ids][]']").attr('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
if($("input[name='all_student_select']").is(':checked')){
|
||||
$("input[name='membership[user_ids][]']").attr('checked', true);
|
||||
}
|
||||
|
||||
$("input[name='membership[user_ids][]']").on('change', function(){
|
||||
var choose_ids = $("#choose_student_ids").val() == "" ? [] : $("#choose_student_ids").val().split(",");
|
||||
if($(this).is(':checked')){
|
||||
if($("input[name='membership[user_ids][]']:checked").length == <%= @users_count %>){
|
||||
$("input[name='all_student_select']").attr('checked', true);
|
||||
}
|
||||
choose_ids.push($(this).val());
|
||||
} else{
|
||||
$("input[name='all_student_select']").attr('checked', false);
|
||||
choose_ids.splice($.inArray($(this).val(),choose_ids),1);
|
||||
}
|
||||
if(choose_ids.length != 0){
|
||||
$("#choose_student_ids").val(choose_ids.join(","));
|
||||
} else{
|
||||
$("#choose_student_ids").val('');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,16 +1,77 @@
|
|||
<% unless @users.empty? %>
|
||||
<% @users.each do |user| %>
|
||||
<% if user && user.user_extensions %>
|
||||
<li class="clearfix">
|
||||
<!--<i class="fa fa-square-o grey fl" aria-hidden="true"></i>-->
|
||||
<!--<i class="fa fa-check-square-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
|
||||
<input id="choose_course_teacher_<%= user.id %>" type="checkbox" class="fl mt7 mr5 magic-checkbox" style="top:0px" name="membership[user_ids][]" value="<%= user.id %>">
|
||||
<label for="choose_course_teacher_<%= user.id %>" style="top:0px">
|
||||
<a href="<%= user_path(user) %>" target="_blank" class="task-hide fl span1 edu-txt-w100"><%= user.show_real_name %>(<%= user.login %>)</a>
|
||||
<span class="fl color-grey span2 ml10"><%= user.identity %></span>
|
||||
<span class="span3 fl ml10 edu-txt-w140 task-hide" style="width: 189px"><%= user.user_extensions.school ? user.user_extensions.school.name : "" %></span>
|
||||
</label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<ul class="upload_select_box fl mb10" style="overflow-y:auto;width:500px;">
|
||||
<% unless @users.empty? %>
|
||||
<% @users.each do |user| %>
|
||||
<% if user && user.user_extensions %>
|
||||
<li class="clearfix">
|
||||
<!--<i class="fa fa-square-o grey fl" aria-hidden="true"></i>-->
|
||||
<!--<i class="fa fa-check-square-o color-blue blue fl" style="display:none;" aria-hidden="true"></i>-->
|
||||
<input id="add_student_<%= user.id %>" type="checkbox" class="fl mt7 mr5 magic-checkbox" name="membership[user_ids][]" value="<%= user.id %>">
|
||||
<label for="add_student_<%= user.id %>" style="top:0px">
|
||||
<a href="<%= user_path(user) %>" target="_blank" class="task-hide span1 edu-name-dark edu-txt-w140"><%= user.show_real_name %>(<%= user.login %>)</a>
|
||||
<span class="span2 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.user_extensions.try(:student_id) %></span>
|
||||
<span class="span3 ml10 edu-txt-w140 task-hide" style="text-align: center"><%= user.login %></span>
|
||||
</label>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<div class="clearfix">
|
||||
<div class="cl mb10">
|
||||
<span class="color-orange none" id="add_teacher_notice"></span>
|
||||
</div>
|
||||
|
||||
<div class="fl pages_little_show">
|
||||
<ul>
|
||||
<%= pagination_links_full @users_pages, @users_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
if($("#choose_student_ids").val() != ""){
|
||||
var choose_ids = $("#choose_student_ids").val().split(",");
|
||||
for (var i = 0; i < choose_ids.length; i++){
|
||||
$("#add_student_" + choose_ids[i]).attr("checked", "checked");
|
||||
}
|
||||
}
|
||||
|
||||
$("#all_student_select").on('change', function(){
|
||||
if($("#all_student_select").is(':checked')){
|
||||
$("#choose_student_ids").val("<%= @user_ids %>");
|
||||
$("input[name='membership[user_ids][]']").attr('checked', true);
|
||||
} else{
|
||||
$("#choose_student_ids").val("");
|
||||
$("input[name='membership[user_ids][]']").attr('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
if($("input[name='all_student_select']").is(':checked')){
|
||||
$("input[name='membership[user_ids][]']").attr('checked', true);
|
||||
}
|
||||
|
||||
$("input[name='membership[user_ids][]']").on('change', function(){
|
||||
var choose_ids = $("#choose_student_ids").val() == "" ? [] : $("#choose_student_ids").val().split(",");
|
||||
if($(this).is(':checked')){
|
||||
if($("input[name='membership[user_ids][]']:checked").length == <%= @users_count %>){
|
||||
$("input[name='all_student_select']").attr('checked', true);
|
||||
}
|
||||
choose_ids.push($(this).val());
|
||||
} else{
|
||||
$("input[name='all_student_select']").attr('checked', false);
|
||||
choose_ids.splice($.inArray($(this).val(),choose_ids),1);
|
||||
}
|
||||
if(choose_ids.length != 0){
|
||||
$("#choose_student_ids").val(choose_ids.join(","));
|
||||
} else{
|
||||
$("#choose_student_ids").val('');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
$(function() {
|
||||
$("#search_not_teacher").live('input', function (e) {
|
||||
throttle(search_not_teacher_f,window,e);
|
||||
});
|
||||
// $("#search_not_teacher").live('input', function (e) {
|
||||
// throttle(search_not_teacher_f,window,e);
|
||||
// });
|
||||
|
||||
$("#search_not_student").live('input', function (e) {
|
||||
throttle(search_not_student_f,window,e);
|
||||
});
|
||||
// $("#search_not_student").live('input', function (e) {
|
||||
// throttle(search_not_student_f,window,e);
|
||||
// });
|
||||
|
||||
//模块切换
|
||||
$(".stud-class-set .news .nav").click(function(e) {
|
||||
|
|
@ -294,23 +294,23 @@ function submit_change_manager_form(){
|
|||
}
|
||||
}
|
||||
|
||||
var lastteSearchCondition = '';
|
||||
//var lastteSearchCondition = '';
|
||||
function search_not_teacher_f(e){
|
||||
if($(e.target).val().trim() == "" || ($(e.target).val().trim() == lastteSearchCondition && lastteSearchCondition != ''))
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastteSearchCondition = $(e.target).val().trim();
|
||||
// if($(e.target).val().trim() == "" || ($(e.target).val().trim() == lastteSearchCondition && lastteSearchCondition != ''))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// lastteSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '/courses/' + $("#course_search_not_teacher_id").val() + '/search_not_teachers',
|
||||
type:'post',
|
||||
data: {is_observe:true, search:e.target.value},
|
||||
data: {is_observe:true, search:$("#search_not_teacher").val().trim(), school:$("#search_not_teacher_school").val().trim()},
|
||||
success: function(data){ }
|
||||
});
|
||||
}
|
||||
|
||||
function submit_add_teacher_form(){
|
||||
if($("input[name='membership[user_ids][]']:checked").length >= 1){
|
||||
if($("#choose_student_ids").val().trim() != ""){
|
||||
if($("input[name='membership[role_ids][]']:checked").length >= 1){
|
||||
$("#add_teacher_notice").html("").hide();
|
||||
$("#add_teacher_form").submit();
|
||||
|
|
@ -341,23 +341,23 @@ function submit_has_group_student_search(id, group_id){
|
|||
)
|
||||
}
|
||||
|
||||
var laststSearchCondition = '';
|
||||
//var laststSearchCondition = '';
|
||||
function search_not_student_f(e){
|
||||
if($(e.target).val().trim() == "" || ($(e.target).val().trim() == laststSearchCondition && laststSearchCondition != ''))
|
||||
{
|
||||
return;
|
||||
}
|
||||
laststSearchCondition = $(e.target).val().trim();
|
||||
// if($(e.target).val().trim() == "" || ($(e.target).val().trim() == laststSearchCondition && laststSearchCondition != ''))
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
// laststSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '/courses/' + $("#course_search_not_student_id").val() + '/search_not_students',
|
||||
type:'post',
|
||||
data: {is_observe:true, search:e.target.value},
|
||||
data: {is_observe:true, search:$("#search_not_student").val().trim(), school:$("#search_not_student_school").val().trim()},
|
||||
success: function(data){ }
|
||||
});
|
||||
}
|
||||
|
||||
function submit_add_student_form(){
|
||||
if($("input[name='membership[user_ids][]']:checked").length >= 1){
|
||||
if($("#choose_student_ids").val().trim() != ""){
|
||||
$("#add_student_notice").html("").hide();
|
||||
$("#add_student_form").submit();
|
||||
hideModal();
|
||||
|
|
|
|||
Loading…
Reference in New Issue