Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
Conflicts: public/stylesheets/new_user.css 2.组织增加项目功能
This commit is contained in:
commit
58365e8892
|
@ -195,7 +195,7 @@ class OrganizationsController < ApplicationController
|
|||
@added_course_ids = @organization.courses.map(&:id)
|
||||
@courses = []
|
||||
user_courses.each do |course|
|
||||
if @added_course_ids.include?(course.id)
|
||||
if !@added_course_ids.include?(course.id)
|
||||
@courses << course
|
||||
end
|
||||
end
|
||||
|
@ -211,4 +211,39 @@ class OrganizationsController < ApplicationController
|
|||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def join_project_menu
|
||||
@organization = Organization.find(params[:id])
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def search_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
condition = '%%'
|
||||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select projects.* from projects inner join members on projects.id = members.course_id where members.user_id = #{User.current.id} and projects.name like '#{condition}'"
|
||||
user_projects = Course.find_by_sql(sql)
|
||||
@added_course_ids = @organization.projects.map(&:id)
|
||||
@projects = []
|
||||
user_projects.each do |project|
|
||||
if !@added_course_ids.include?(project.id)
|
||||
@projects << project
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def join_projects
|
||||
@organization = Organization.find(params[:id])
|
||||
project_ids = params[:projectNames]
|
||||
project_ids.each do |id|
|
||||
OrgProject.create(:organization_id => @organization.id, :project_id => id.to_i, :created_at => Time.now)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -86,6 +86,18 @@
|
|||
<%= link_to "动态",organization_path(@organization), :class => "homepageMenuText" %>
|
||||
</div>
|
||||
<div class="homepageLeftMenuBlock"><a href="javascript:void(0);" class="homepageMenuText">项目</a>
|
||||
<div class="courseMenu" id="projectMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon" id="projectMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_project_menu" style="line-height:1;">
|
||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||
<li>
|
||||
<%= link_to "加入项目",join_project_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<a href="javascript:void(0);" class="homepageMenuSetting fr" title="关联您的已有项目"></a>-->
|
||||
</div>
|
||||
<div class="homepageLeftMenuCourses borderBottomNone">
|
||||
|
@ -101,7 +113,7 @@
|
|||
<div class="courseMenu" id="courseMenu">
|
||||
<ul>
|
||||
<li class="courseMenuIcon" id="courseMenuIcon">
|
||||
<ul class="topnav_course_menu" id="topnav_course_menu">
|
||||
<ul class="topnav_course_menu" id="topnav_course_menu" style="line-height:1;">
|
||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||
<li>
|
||||
<%= link_to "加入课程",join_course_menu_organization_path(@organization),:remote => true,:class => "menuGrey",:method => "post"%>
|
||||
|
@ -147,6 +159,12 @@
|
|||
$("#courseMenu").mouseleave(function(){
|
||||
$("#topnav_course_menu").hide();
|
||||
});
|
||||
$("#projectMenu").mouseenter(function(){
|
||||
$("#topnav_project_menu").show();
|
||||
});
|
||||
$("#projectMenu").mouseleave(function(){
|
||||
$("#topnav_project_menu").hide();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></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="ml5"></div>
|
||||
<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>
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
<!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(){
|
||||
$(".resourceSharePopup").css("display","none");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="resourceSharePopup">
|
||||
<div>
|
||||
<div class="relateText fl">请选择关联到组织的项目</div>
|
||||
</div>
|
||||
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose"></a></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"></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="cancel_join_projects();" class="sendSourceText">取消</a></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</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() {
|
||||
$("#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>
|
|
@ -1,12 +1,3 @@
|
|||
$('#topnav_course_menu').hide();
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_course_menu', :locals => {:organization_id => @organization.id}) %>');
|
||||
$('#ajax-modal').show();
|
||||
//showModal('ajax-modal', '540px');
|
||||
//$('#ajax-modal').css('height','390px');
|
||||
////$('#ajax-modal').siblings().remove();
|
||||
////$('#ajax-modal').siblings().hide();
|
||||
//$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
|
||||
// "<a href='javascript:' onclick=' hideModal($('#resourceSharePopup''));'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
//$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
//$('#ajax-modal').parent().css("top","").css("left","");
|
||||
//$('#ajax-modal').parent().addClass("alert_box");
|
|
@ -0,0 +1,3 @@
|
|||
$('#topnav_project_menu').hide();
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_project_menu', :locals => {:organization_id => @organization.id}) %>');
|
||||
$('#ajax-modal').show();
|
|
@ -0,0 +1,9 @@
|
|||
$("#search_projects_result_list").html("");
|
||||
$("#search_projects_result_list").append('<ul class="ml5">');
|
||||
|
||||
<% @projects.each do |project|%>
|
||||
link = "<li><label><input type='checkbox'class='mr5 fl mt3' name='projectNames[]' value='<%=project.id%>'/><span class='search_org fl'> <%=project.name %> </span></label></li><div class='cl mt5'></div>";
|
||||
$("#search_projects_result_list").append(link );
|
||||
<%end %>
|
||||
$("#search_projects_result_list").append('</ul>')
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
<div class="postBanner" style="padding-bottom:5px;">
|
||||
<span class="linkGrey2 f16">组织列表</span>
|
||||
|
||||
<!--<%#= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %>-->
|
||||
<!--<input type="text" name="search_orgs" placeholder="输入关键词进行搜索" class="problem_search_input fl"/>-->
|
||||
<%#= form_tag url_for(:controller => 'users', :action => 'search_user_orgs', :id => User.current.id), :method => 'get', :id => "search_org_form", :class=>"resourcesSearchloadBox", :style=>"float:right; margin-top:-5px;" do %>
|
||||
<!--<input type="text" name="search_orgs" placeholder="输入关键词进行搜索" class="searchResource" />-->
|
||||
|
||||
<!--<!–<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#search_org_form').submit();"></a>–>-->
|
||||
<!--<a href="javascript:void(0);" class="problem_search_btn fl" onclick="$('#search_org_form').submit();">搜索</a>-->
|
||||
|
|
|
@ -2081,7 +2081,7 @@ zh:
|
|||
label_co_organizer_BHU: 北京航空航天大学
|
||||
label_co_organizer_CAS: 中国科学院软件研究所
|
||||
label_co_organizer_InforS: 中创软件
|
||||
label_rights_reserved: Copyright 2007~2015, All Rights Riserved
|
||||
label_rights_reserved: Copyright 2007~2015, All Rights Reserved
|
||||
label_about_us: 关于我们
|
||||
label_contact_us: 联系我们
|
||||
label_recruitment_information: 招聘信息
|
||||
|
|
|
@ -42,6 +42,9 @@ RedmineApp::Application.routes.draw do
|
|||
get 'search_courses'
|
||||
post 'join_course_menu'
|
||||
post 'join_courses'
|
||||
get 'search_projects'
|
||||
post 'join_project_menu'
|
||||
post 'join_projects'
|
||||
end
|
||||
collection do
|
||||
get 'check_uniq'
|
||||
|
|
|
@ -385,6 +385,7 @@ a.uploadText {color:#ffffff; font-size:14px;}
|
|||
.resourcesSearchloadBox {border:1px solid #e6e6e6; width:225px; float:left; background-color:#ffffff;}
|
||||
.searchResource {border:none; outline:none; background-color:#ffffff; width:184px; height:32px; padding-left:10px; display:block; float:left;}
|
||||
.searchCourse {border:none; outline:none; background-color:#ffffff; width:184px; padding-left:10px; display:block; margin-bottom:15px;}
|
||||
.searchResource:focus {border:none;}
|
||||
.searchIcon{width:31px; height:32px; background-color:#ffffff; background:url(images/resource_icon_list.png) -40px -15px no-repeat; display:block; float:left;}
|
||||
/*.resourcesSearchBanner {height:34px; margin-bottom:10px;}*/
|
||||
.resourcesSearchBanner {width:710px; height:34px; margin-bottom:10px; margin-top:15px; margin-left:auto; margin-right:auto;}
|
||||
|
|
|
@ -37,7 +37,7 @@ a.org_member_btn{ padding:1px 5px; background:#15bccf; color:#fff;}
|
|||
/*项目关联css*/
|
||||
.relateOrg {width:335px;}
|
||||
.relatedList {width:335px;}
|
||||
.searchOrg {height:24px; width:200px; color:#9b9b9b9; border:1px solid #15bccf;}
|
||||
.searchOrg {height:24px; width:200px; color:#9b9b9b; border:1px solid #15bccf;}
|
||||
a.cancelBtn {padding:3px 5px; background-color:#D9D9D9; color:#656565;}
|
||||
a.cancelBtn:hover {background-color:#717171; color:#ffffff;}
|
||||
.relatedList ul li {border-bottom:1px solid #e4e4e4; width:320px; height:22px; vertical-align:middle; line-height:22px;}
|
||||
|
@ -50,4 +50,8 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;}
|
|||
.mt28 {margin-top:28px;}
|
||||
.orgWrap {width:880px; float:left;}
|
||||
.orgTitle {width:880px; max-width:880px; margin-bottom:5px;word-break: break-all; word-wrap:break-word; }
|
||||
.orgIntro {width:880px; max-width:880px; margin-bottom:6px; color:#484848;}
|
||||
.orgIntro {width:880px; max-width:880px; margin-bottom:6px; color:#484848;}
|
||||
|
||||
/*关联项目弹窗*/
|
||||
.projectRelate {float:left; max-height:118px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden; width:288px;}
|
||||
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
|
Loading…
Reference in New Issue