增加网站项目首页加入项目的功能

This commit is contained in:
sw 2015-01-22 17:03:01 +08:00
parent 683625066e
commit 90a81ee1f1
6 changed files with 109 additions and 1 deletions

View File

@ -35,7 +35,7 @@ class ProjectsController < ApplicationController
# edit
before_filter :authorize1, :only => [:show]
#
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches]
before_filter :find_project, :except => [ :index, :search,:list, :new, :create, :copy, :statistics, :new_join, :course, :enterprise_course, :course_enterprise,:view_homework_attaches,:join_project]
# before_filter :authorize, :except => [:new_join, :new_homework, :homework, :statistics, :search, :watcherlist, :index, :list, :new, :create, :copy, :archive, :unarchive, :destroy, :member, :focus, :file,
# :statistics, :feedback, :course, :enterprise_course, :course_enterprise, :project_respond, :share,
# :show_projects_score, :issue_score_index, :news_score_index, :file_score_index, :code_submit_score_index, :projects_topic_score_index]
@ -917,6 +917,14 @@ class ProjectsController < ApplicationController
end
end
end
#加入私有项目
def join_project
respond_to do |format|
format.js
end
end
private
def memberAccess

View File

@ -0,0 +1,83 @@
<!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" />
<title>快速进入项目通道</title>
<style>
#popbox{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
#popbox div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span{ margin:0; padding:0;}
#popbox div,img,tr,td{ border:0;}
#popbox table,tr,td{border:0; cellspacing:0; cellpadding:0;}
#popbox ul,li{ list-style-type:none}
#popbox .cl{ clear:both; overflow:hidden; }
#popbox a{ text-decoration:none; }
#popbox a:hover{ }
.alert_box {width:400px;height:200px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; }
#popbox{width:400px;height:200px;}
.alert .C{width:388px;height:200px;position:absolute;left:5px;top:5px; }
.C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px !important; }
.C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
.C_top p{ color:#a9aaaa; line-height:22px;}
.C_form{ margin:20px 0 0 60px;}
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; padding-left: 60px;}
.C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:150px;}
.width190{ width:190px; height:26px; border-color:#e1e1e1;}
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
.C_form a:hover{ text-decoration:underline;}
.C_form a.btn{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#15bccf; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
.C_form a.btn:hover{ background:#ff821d;}
</style>
<script type="text/javascript">
function submit_form(obj)
{
hideModal(obj);
$("#new-watcher-form").submit();
alert("申请成功");
}
function hidden_join_course_form()
{
hideModal($("#popbox"));
}
</script>
</head>
<body>
<div id="popbox">
<div class="C" >
<div class="C_top">
<h2>快速进入项目通道</h2>
<p>只要持有项目的ID就可快速申请加入所在项目。项目页面搜索不到的私有项目只能从此通道进入哦</p>
</div>
<div class="C_form">
<%= form_tag({:controller => 'applied_project',
:action => 'applied_join_project'},
:remote => true,
:method => :post,
:id => 'new-watcher-form') do %>
<ul>
<li style="padding-top: 15px;">
<span class="tips">项&nbsp;目&nbsp;ID</span>
<input type="hidden" name="user_id" value="<%= User.current.id%>">
<input class=" width190" name="project_id" id="project_id" type="text" value="" >
<input type="text" style="display: none"/>
</li>
<li class="mB5">项目ID是所在项目网址中显示的序号</li>
<li>
<a href="#" class="btn" style="margin-left: 50px;" onclick="submit_form(this);">
<%= l(:label_new_join) %>
</a>
<a href="#" class="btn" style="margin-left: 20px;" onclick="hideModal(this);">
<%= l(:button_cancel)%>
</a>
</li>
</ul>
<% end%>
</div>
</div><!---- C end---->
</div>
</body>
</html>

View File

@ -0,0 +1,9 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'projects/join_project') %>');
showModal('ajax-modal', '510px');
$('#ajax-modal').css('height','260px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +
"<a href='#' onclick='hidden_join_course_form();'><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");

View File

@ -66,6 +66,9 @@
:course => 0,
:project_type =>( @project_type||=0)},
:class => 'icon icon-add') if User.current.allowed_to?(:add_project, nil, :global => true) %>
&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to l(:label_join_project), join_project_projects_path ,:remote => true, :class => 'icon icon-add' %>
&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
</span>
<div class="d-p-projectlist-box">

View File

@ -2282,4 +2282,5 @@ zh:
label_answer: 答案:
label_poll_answer_valid_result: 以上为有效问答题答案!
label_answer_total: 总计:
label_join_project: 加入项目

View File

@ -377,6 +377,10 @@ RedmineApp::Application.routes.draw do
match 'copy', :via => [:get, :post]
end
collection do
match 'join_project', :via => [:get, :post]
end
#by young
match '/member', :to => 'projects#member', :as => 'member', :via => :get
match '/file', :to => 'projects#file', :as => 'file', :via => :get