2015-12-08 17:37:15 +08:00
|
|
|
<div id="popbox02" style="">
|
|
|
|
<span class="f16 fontBlue">关联项目</span>
|
|
|
|
<a href="javascript:void(0);" class="popClose" onclick="clickCanel();"></a>
|
2015-12-09 10:29:54 +08:00
|
|
|
<%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:is_in_course=>@is_in_course,:course_activity =>@course_activity),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>
|
|
|
|
<input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" />
|
|
|
|
<div class="cl"></div>
|
2015-12-16 17:38:28 +08:00
|
|
|
<p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未创建任何项目,请先创建项目再关联。</p>
|
2015-12-09 10:29:54 +08:00
|
|
|
<ul id="search_project_list" class="maxHeight100"></ul>
|
|
|
|
<p id="notes" class="c_red"></p>
|
|
|
|
<div class="courseSendSubmit mt10"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK();">确定</a></div>
|
|
|
|
<div class="courseSendCancel mt10"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
|
2015-12-08 17:37:15 +08:00
|
|
|
<div class="cl"></div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var lastSearchCondition = '';
|
|
|
|
var count = 0;
|
2015-12-09 10:29:54 +08:00
|
|
|
function search_pros(e){
|
2015-12-08 17:37:15 +08:00
|
|
|
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
lastSearchCondition = $(e.target).val().trim();
|
|
|
|
$.ajax({
|
2015-12-09 10:29:54 +08:00
|
|
|
url: '<%= url_for(:controller => 'student_work', :action => 'search_user_projects') %>'+'?name='+ e.target.value,
|
2015-12-08 17:37:15 +08:00
|
|
|
type:'get'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function throttle(method,context,e){
|
|
|
|
clearTimeout(method.tId);
|
|
|
|
method.tId=setTimeout(function(){
|
|
|
|
method.call(context,e);
|
|
|
|
},500);
|
|
|
|
}
|
|
|
|
|
2015-12-11 14:57:09 +08:00
|
|
|
//查询项目
|
2015-12-09 10:29:54 +08:00
|
|
|
$("input[name='project']").on('input', function (e) {
|
|
|
|
throttle(search_pros,window,e);
|
2015-12-08 17:37:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
$(document).ready(function(){
|
|
|
|
$.ajax({
|
2015-12-09 10:29:54 +08:00
|
|
|
url: '<%= url_for(:controller => 'student_work', :action => 'search_user_projects') %>'+'?first=1',
|
2015-12-08 17:37:15 +08:00
|
|
|
type:'get'
|
|
|
|
});
|
|
|
|
});
|
2015-12-09 10:29:54 +08:00
|
|
|
|
|
|
|
function clickOK() {
|
|
|
|
var radio = $("input[name='projectName']:checked");
|
|
|
|
if(radio.length < 1) {
|
|
|
|
$("#notes").html("请先选择一个项目");
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
$("#student_work_relate_project").submit();
|
|
|
|
}
|
2015-12-08 17:37:15 +08:00
|
|
|
}
|
|
|
|
</script>
|