100 lines
3.4 KiB
Plaintext
100 lines
3.4 KiB
Plaintext
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link href="css/public.css" rel="stylesheet" type="text/css" />
|
|
<link href="css/org.css" rel="stylesheet" type="text/css" />
|
|
<script src="js/jquery-1.3.2.js" type="text/javascript"></script>
|
|
<script type="text/javascript" src="js/bootstrap.js"></script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
var popupHeight = $(".resourceSharePopup").outerHeight(true);
|
|
$(".resourceSharePopup").css("marginTop",-popupHeight/2);
|
|
|
|
|
|
$(".resourcePopupClose").click(function(){
|
|
location.reload();
|
|
$(".resourceSharePopup").css("display","none");
|
|
});
|
|
});
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
<!--<div class="resourceSharePopup">-->
|
|
<div>
|
|
<div class="relateText fl">请选择关联到组织的课程</div>
|
|
</div>
|
|
<div class="fl">
|
|
<%=form_tag url_for(:controller => 'organizations', :action => 'join_courses', :organization_id => organization_id),:method => 'post', :id => 'join_courses_form', :remote => true,:class=>"resourcesSearchBox" do %>
|
|
<input type="text" name="courses" placeholder="搜索您已加入的课程的名称" class="searchCourse" />
|
|
<div id="search_courses_result_list" class="mb8"></div>
|
|
<div class="courseSendSubmit">
|
|
<a href="javascript:void(0);" onclick="org_join_courses(<%= organization_id %>);" class="sendSourceText">关联</a>
|
|
</div>
|
|
<div class="courseSendCancel"><a href="javascript:void(0);" onclick="cancel_join_courses();" class="sendSourceText">取消</a></div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="cl"></div>
|
|
<div>
|
|
</div>
|
|
<div class="cl"></div>
|
|
<!--</div>-->
|
|
|
|
<script type="text/javascript">
|
|
var lastSearchCondition = '';
|
|
var page = 1;
|
|
var count = 0;
|
|
var maxPage = 0;
|
|
function search_courses(e){
|
|
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
|
{
|
|
return;
|
|
}
|
|
lastSearchCondition = $(e.target).val().trim();
|
|
$.ajax({
|
|
url: '<%= url_for(:controller => 'organizations', :action => 'search_courses') %>'+'?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='courses']").on('input', function (e) {
|
|
throttle(search_courses,window,e);
|
|
});
|
|
|
|
$(document).ready(function(){
|
|
$.ajax({
|
|
url: '<%= url_for(:controller => 'organizations', :action => 'search_courses') %>',
|
|
type:'get'
|
|
});
|
|
});
|
|
function cancel_join_courses() {
|
|
$("#join_courses_form input:checked").attr("checked", false);
|
|
//$("#search_courses_result_list").html("");
|
|
}
|
|
function org_join_courses(orgId) {
|
|
$.ajax({
|
|
url: "/organizations/"+orgId + "/join_courses?" + $("#join_courses_form").serialize(),
|
|
type: "post",
|
|
success: function (data) {
|
|
$.ajax({
|
|
url: "/organizations/" + orgId + "/search_courses?name=" + $("input[name='courses']").val().trim(),
|
|
type: "get"
|
|
});
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|