socialforge/app/views/admin/_all_schools.html.erb

55 lines
2.2 KiB
Plaintext

<%= stylesheet_link_tag 'css/common','css/popup' %>
<div class="boxContainer" style="height: auto;">
<div class="sendText fl mr10" style="width: auto">更改为</div>
<div class="cl"></div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
<div>
<!--<input type="text" name="search" placeholder="输入班级ID或者名称搜索" class="subjectSearch fr" />-->
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入名称搜索" class="mt10 mb10 course-search" />
</div>
<div id="schools_list">
<%= render :partial => "admin/update_school_form", :locals => {:schools => schools, :edit_id => edit_id} %>
</div>
</div>
<script type="text/javascript">
function school_submit() {
var checkboxs = $("input[name='school_id[]']:checked");
if(checkboxs.length == 0) {
$("#choose_courses_notice").text("请选择单位");
} else{
$("#choose_courses_notice").text("");
$("#schools_list_form").submit();
hideModal();
}
}
var lastSearchCondition = '';
var count = 0;
function search_courses(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'admin', :action => 'all_schools') %>'+'?search='+ e.target.value+'&school_id=<%=edit_id %>',
type:'get',
data: {is_observe:true},
success: function(data){ },
beforeSend: function(){ $(this).addClass('ajax-loading'); },
complete: function(){ $(this).removeClass('ajax-loading'); }
});
}
function throttle(method,context,e){
clearTimeout(method.tId);
method.tId=setTimeout(function(){
method.call(context,e);
},500);
}
//查询项目
$("input[name='search']").on('input', function (e) {
throttle(search_courses,window,e);
});
</script>