81 lines
3.0 KiB
Plaintext
81 lines
3.0 KiB
Plaintext
<div id="muban_popup_box" style="width:745px;">
|
|
<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">
|
|
<div class="newupload_conbox">
|
|
<div class="newupload_search_box mb10">
|
|
<input class="newupload_search_input" placeholder="输入试卷标题的关键词进行搜索" name="search" type="text">
|
|
<a href="javascript:void(0);" class="newupload_btn_search"></a>
|
|
</div>
|
|
</div>
|
|
<%=form_tag import_other_exercise_exercise_index_path,
|
|
method: :post,
|
|
remote: true,
|
|
id: "import_other_exercise_form" do %>
|
|
<input type="hidden" name="course_id" value="<%= course_id%>" />
|
|
<div class="ml15">
|
|
<div id="all_import_exercises">
|
|
<%=render :partial => 'all_import_exercises', :locals => {:exercises => exercises, :course_id => course_id, :order => @order} %>
|
|
</div>
|
|
<div class="clear">
|
|
<p class="none c_red" id="choose_exercise_notice"></p>
|
|
<div class="clear fl mt10">
|
|
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="submit_import_form();">确定</a>
|
|
<a href="javascript:void(0)" class="btn fr mr5" onclick="hideModal();">取消</a>
|
|
</div>
|
|
<div class="fr mr10">
|
|
<div class="pages" style="width:auto; display:inline-block;">
|
|
<ul id="exercise_ref_pages">
|
|
<%= pagination_links_full @ex_pages, @ex_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true%>
|
|
</ul>
|
|
<div class="cl"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function submit_import_form(){
|
|
var checkboxs = $("input[name='exercise_id[]']:checked");
|
|
if(checkboxs.length > 0) {
|
|
$("#choose_exercise_notice").html("");
|
|
$('#import_other_exercise_form').submit();
|
|
hideModal();
|
|
} else{
|
|
$("#choose_exercise_notice").html("请至少选择一个试卷");
|
|
$("#choose_exercise_notice").show();
|
|
}
|
|
}
|
|
|
|
var lastSearchCondition = '';
|
|
var count = 0;
|
|
function search_exs(e){
|
|
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
|
{
|
|
return;
|
|
}
|
|
lastSearchCondition = $(e.target).val().trim();
|
|
$.ajax({
|
|
url: '<%= url_for(:controller => 'exercise', :action => 'search_exercises') %>'+'?name='+ e.target.value+'&course_id=<%=course_id %>',
|
|
type:'get'
|
|
});
|
|
}
|
|
|
|
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_exs,window,e);
|
|
});
|
|
</script> |