64 lines
2.4 KiB
Plaintext
64 lines
2.4 KiB
Plaintext
<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 ml30 mr30 mt10">
|
|
<%= form_for('new_form',:url =>{:controller => 'student_work',:action => 'change_project',:homework => @homework.id},:method => "post", :remote => true) do |f|%>
|
|
<input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" />
|
|
<div class="cl"></div>
|
|
<p id="no_search_result" class="c_red f14" style="width:320px;display: none">您当前尚未创建任何项目,请先创建项目再关联。</p>
|
|
<ul id="search_project_list" class="maxHeight200"></ul>
|
|
<p id="notes" class="c_red"></p>
|
|
<a href="javascript:void(0);" class="sy_btn_blue fr" onclick="clickOK();">确定</a>
|
|
<a href="javascript:void(0);" class="sy_btn_grey fr mr5" onclick="clickCanel();">取消</a>
|
|
<div class="cl"></div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
var lastSearchCondition = '';
|
|
var count = 0;
|
|
function search_pros(e){
|
|
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
|
{
|
|
return;
|
|
}
|
|
lastSearchCondition = $(e.target).val().trim();
|
|
$.ajax({
|
|
url: '<%= url_for(:controller => 'student_work', :action => 'search_user_projects') %>'+'?name='+ e.target.value,
|
|
type:'get'
|
|
});
|
|
}
|
|
|
|
function throttle(method,context,e){
|
|
clearTimeout(method.tId);
|
|
method.tId=setTimeout(function(){
|
|
method.call(context,e);
|
|
},500);
|
|
}
|
|
|
|
//查询项目
|
|
$("input[name='project']").on('input', function (e) {
|
|
throttle(search_pros,window,e);
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
$.ajax({
|
|
url: '<%= url_for(:controller => 'student_work', :action => 'search_user_projects') %>'+'?first=1',
|
|
type:'get'
|
|
});
|
|
});
|
|
|
|
function clickOK() {
|
|
var radio = $("input[name='projectName']:checked");
|
|
if(radio.length < 1) {
|
|
$("#notes").html("请先选择一个项目");
|
|
return false;
|
|
} else {
|
|
$("#muban_popup_box").find('form').submit();
|
|
hideModal();
|
|
}
|
|
}
|
|
</script> |