socialforge/app/views/organizations/_join_course_menu.html.erb

101 lines
3.5 KiB
Plaintext
Raw Normal View History

2015-11-26 16:29:50 +08:00
<!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();
2015-11-26 16:29:50 +08:00
$(".resourceSharePopup").css("display","none");
});
});
</script>
</head>
<body>
2015-12-07 12:53:51 +08:00
<!--<div class="resourceSharePopup">-->
2015-11-26 16:29:50 +08:00
<div>
<div class="relateText">请选择关联到组织的课程</div>
<div class="c_red">您的私有课程不能被关联到组织</div>
2015-11-26 16:29:50 +08:00
</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 maxHeight100" style="overflow:auto;"></div>
2015-11-26 16:29:50 +08:00
<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="hideModal();" class="sendSourceText">取消</a></div>
2015-11-26 16:29:50 +08:00
<% end %>
</div>
<div class="cl"></div>
<div>
</div>
<div class="cl"></div>
2015-12-07 12:53:51 +08:00
<!--</div>-->
2015-11-26 16:29:50 +08:00
<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("");
2015-11-26 16:29:50 +08:00
}
function org_join_courses(orgId) {
$.ajax({
url: "/organizations/"+orgId + "/join_courses?" + $("#join_courses_form").serialize(),
type: "post",
success: function (data) {
2015-12-18 14:30:25 +08:00
// $.ajax({
// url: "/organizations/" + orgId + "/search_courses?name=" + $("input[name='courses']").val().trim(),
// type: "get"
// });
2015-11-26 16:29:50 +08:00
}
});
}
</script>
</body>
</html>