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

96 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>
<div class="relateText fl">请选择关联到组织的项目</div>
</div>
<div class="fl">
<%=form_tag url_for(:controller => 'organizations', :action => 'join_projects', :organization_id => organization_id),:method => 'post', :id => 'join_projects_form', :remote => true,:class=>"resourcesSearchBox" do %>
<input type="text" name="projects" placeholder="搜索您已加入的项目的名称" class="searchCourse" />
<div id="search_projects_result_list" class="mb8 maxHeight100"></div>
<div class="courseSendSubmit">
<a href="javascript:void(0);" onclick="org_join_projects(<%= organization_id %>);" class="sendSourceText">关联</a>
</div>
<div class="courseSendCancel"><a href="javascript:void(0);" onclick="hideModal();" class="sendSourceText">取消</a></div>
<% end %>
</div>
<div class="cl"></div>
<script type="text/javascript">
var lastSearchCondition = '';
var page = 1;
var count = 0;
var maxPage = 0;
function search_projects(e){
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
{
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'organizations', :action => 'search_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='projects']").on('input', function (e) {
throttle(search_projects,window,e);
});
$(document).ready(function(){
$.ajax({
url: '<%= url_for(:controller => 'organizations', :action => 'search_projects') %>',
type:'get'
});
});
function cancel_join_projects() {
$("#join_projects_form input:checked").attr("checked", false);
//$("#search_projects_result_list").html("");
}
function org_join_projects(orgId) {
$.ajax({
url: "/organizations/"+orgId + "/join_projects?" + $("#join_projects_form").serialize(),
type: "post",
success: function (data) {
// $.ajax({
// url: "/organizations/" + orgId + "/search_projects?name=" + $("input[name='projects']").val().trim(),
// type: "get"
// });
}
});
}
</script>
</body>
</html>