项目邀请弹框

This commit is contained in:
huang 2016-07-26 08:55:07 +08:00
parent 774650c819
commit 463c09f02c
11 changed files with 261 additions and 94 deletions

View File

@ -51,7 +51,7 @@ gem 'elasticsearch-rails'
### profile
gem 'oneapm_rpm'
# gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'

View File

@ -2,44 +2,45 @@ class AppliedProjectController < ApplicationController
#申请加入项目
def applied_join_project
@user_id = params[:user_id]
@project = Project.find_by_id(params[:project_id])
if params[:project_join]
if @project
user = User.find @user_id
if user.member_of?(@project)
@status = 3
else
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
if @applieds.count == 0
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
Mailer.run.applied_project(appliedproject)
@status = 2
else
@status = 1
end
end
else
@status = 0
end
respond_to do |format|
format.js
end
return
end
@applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
if @applieds.count == 0
appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
Mailer.run.applied_project(appliedproject)
end
#redirect_to project_path(params[:project_id])
#redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
respond_to do |format|
format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
format.js { render :partial => 'set_applied'}
end
# @user_id = params[:user_id]
# @project = Project.find_by_id(params[:project_id])
# if params[:project_join]
# if @project
# user = User.find @user_id
# if user.member_of?(@project)
# @status = 3
# else
# @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
# if @applieds.count == 0
# appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
# Mailer.run.applied_project(appliedproject)
# @status = 2
# else
# @status = 1
# end
# end
# else
# @status = 0
# end
# respond_to do |format|
# format.js
# end
# return
# end
#
# @applieds = AppliedProject.where("user_id = ? and project_id = ?", params[:user_id],params[:project_id])
# if @applieds.count == 0
# appliedproject = AppliedProject.create(:user_id => params[:user_id], :project_id => params[:project_id])
# Mailer.run.applied_project(appliedproject)
# end
#
# #redirect_to project_path(params[:project_id])
# #redirect_to_referer_or {render :text => ( 'applied success.'), :layout => true}
# respond_to do |format|
# format.html { redirect_to_referer_or {render :text => (watching ? 'Watcher added.' : 'Watcher removed.'), :layout => true}}
# format.js { render :partial => 'set_applied'}
# end
end
#取消申请

View File

@ -366,20 +366,27 @@ module WatchersHelper
#申请加入项目
def join_in_project_link(project, user, options=[])
return '' unless user && user.logged?
applied = project.applied_projects.find_by_user_id(user.id)
text = applied ? l(:label_unapply_project) : l(:label_apply_project)
@applied_flag = project.instance_of?(Project)
if applied
appliedid = applied.id
end
id = applied_css(project)
url = appliedproject_path(
:id=>appliedid,
:user_id => user.id,
:project_id => project.id)
url = applied ? unapplied_join_project_path(:object_id => project.id) : applied_join_project_path(:object_id => project.id)
method = applied ? 'delete' : 'post'
link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id
@applied_flag = project.instance_of?(Project)
if applied
link = link_to(text, url, :remote => true, :method => method, :class => "sy_btn_grey fl", :id => "#{project.id}")
else
link = link_to(text, url, :remote => true, :method => method, :id => "#{project.id}", :class => "sy_btn_grey fl")
end
link.html_safe
# if applied
# appliedid = applied.id
# end
# id = applied_css(project)
# url = appliedproject_path(
# :id=>appliedid,
# :user_id => user.id,
# :project_id => project.id)
# method = applied ? 'delete' : 'post'
# link_to text, url, :remote => true, :method => method , :class => "pr_join_a",:id => id
end
def paginateHelper obj, pre_size=20

View File

@ -0,0 +1,28 @@
<div class="sy_popup_top">
<h3 class="fl">欢迎加入项目</h3>
<a href="javascript:void(0);" class="sy_icons_close fr"></a>
<div class="cl"></div>
</div>
<div class="sy_popup_con" style="width:370px;">
<ul class="sy_popup_add ">
<li>
<label >项目邀请码:</label>
<input class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px">
<div class="cl"></div>
</li>
<li>
<label >身份:</label>
<input type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>
<input type="radio" class="ml5 mr5 " /><span class="mr10">开发人员</span>
<input type="radio" class="ml5 mr5 " /><span class="mr10">报告人员</span>
<div class="cl"></div>
</li>
<li>
<label>&nbsp;</label>
<a href="javascript:void(0);" class="sy_btn_blue fl">确&nbsp;&nbsp;定</a>
<a href="javascript:void(0);" class="sy_btn_grey fl ml20">取&nbsp;&nbsp;消</a>
<div class="cl"></div>
</li>
</ul>
</div>

View File

@ -1,14 +1,7 @@
// @status: 0 该项目不存在1 不重复加入2 成功加入; 3 已是项目成员;其它 加入失败
<% if @status == 0%>
alert("<%= l('project.join.tips.notexist') %>");
<% elsif @status == 1%>
alert("<%= l('project.join.tips.repeat') %>");
<% elsif @status == 2%>
alert("<%= l('project.join.tips.success') %>");
hideModal($("#popbox"));
$("#applied_project_link_<%= @project.id%>").replaceWith("<%=escape_javascript(link_to '取消申请',appliedproject_applied_path(:project_id => @project.id,:user_id => User.current.id),:class => "blue_n_btn fr mt20", :remote => "true",:method => "delete",:id => "applied_project_link_#{@project.id}")%>");
<% elsif @status == 3%>
alert("<%= l('project.join.tips.has') %>");
<%else%>
alert("<%= l('project.join.tips.fail') %>");
<%end%>
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'applied_join_project', locals: { :course => @course}) %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");

View File

@ -721,8 +721,8 @@ RedmineApp::Application.routes.draw do
post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue'
delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue'
post 'appliedproject/applied', :to => 'applied_project#applied_join_project', :as => 'appliedproject'
delete 'appliedproject/applied', :to => 'applied_project#unapplied_join_project'
post 'applied_project/applied_join', :to => 'applied_project#applied_join_project', :as => 'applied_join_project'
delete 'applied_project/applied', :to => 'applied_project#unapplied_join_project', :as => 'unapplied_join_project'
resources :projects do
member do

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1492,6 +1492,22 @@ function pop_up_box(value,tWidth,tTop,tLeft){
}
}
// 公共弹框样式
// title
function pop_box_new(value, tWidth, tTop, tLeft){
$("#ajax-modal").html(value);
showModal('ajax-modal', tWidth + "px");
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-right: 5px; margin-top:-10px;right:0;' class='sy_icons_close fr'></a>");
$('#ajax-modal').parent().css("top", tTop+"%").css("left", tLeft+"%").css("padding-top", "10px").css("position", "fixed");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left", "16px").css("padding-bottom", "16px");
function hideModal(){
$('#ajax-modal').hide();
}
}
//显示的时候根据当前网址是http 还是https 选择视频显示方式直接显示还是弹框
function autoMedia(id){
var rootPath = getRootPath();

View File

@ -542,6 +542,37 @@ a:hover.BlueCirBtnMini{ background:#269ac9; color:#fff;}
.borderRadius {border-radius:5px;}
a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.Blue-btn{ background:#3598db; color:#fff;}
/*20160725 项目申请按钮*/
a.sy_btn_grey{
color: #333;
background: #e1e1e1;
text-align: center;
font-size: 12px;
padding:0 15px;
height: 30px;
line-height: 30px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.sy_btn_grey{ background: #c3c3c3;}
a.sy_btn_blue{
display:block;
width:80px;
height: 30px;
text-align:center;
color: #fff;
background: #3b94d6;
font-size: 12px;
line-height: 30px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.sy_btn_blue{ background: #2788d0;}
/* commonpic */
.pic_date{ display:block; background:url(/images/public_icon.png) -31px 0 no-repeat; width:16px; height:15px; }
.pic_add{ display:block; background:url(/images/public_icon.png) -31px -273px no-repeat; width:16px; height:15px; }

View File

@ -332,4 +332,95 @@ a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: no
.relatePWrap{max-height: 210px;overflow:hidden;}
/*20160622代码分析弹窗*/
.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;}
.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;}
/*公共弹框*/
/* 按钮*/
/* 加入班级弹窗 */
#sy_popup_box{
width:460px;
background:#fff;
padding-bottom:30px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
border-radius:5px;
box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);
}
.sy_popup_top{
background:#3b94d6;
height:40px;
-webkit-border-radius: 5px 5px 0px 0px;
-moz-border-radius: 5px 5px 0px 0px;
-o-border-radius: 5px 5px 0px 0px;
border-radius: 5px 5px 0px 0px;
}
.sy_popup_top h3{
font-size:18px;
color:#fff;
font-weight:normal;
line-height:40px;
padding-left:10px;
}
a.sy_icons_close{
width:20px;
height:20px;
display:block;
background: url(../images/sy/sy_icons_close.png) 0 0px no-repeat;
margin:8px 10px 0 0;
}
a:hover.sy_icons_close{
background: url(../images/sy/sy_icons_close.png) -40px 0px no-repeat;
}
.sy_popup_con{
margin:30px auto 0;
font-size:14px;
width:330px;
}
.sy_popup_add label{
display:block;
float:left;
width:85px;
text-align:right;
line-height:40px;
}
.sy_popup_add li{
line-height:40px;
}
.sy_input_txt{
border:1px solid #dedede;
height:36px;
background:#fff;
padding:0 5px;
width:220px;
}
.sy_popup_con02{
margin:30px auto 0;
font-size:14px;
text-align:center;
width:360px;
}
.sy_popup_con02 ul li p{
margin-bottom:15px;
text-align:center;
font-size:14px;
color:#616161;
}
.sy_popup_con02 a{ margin:0 auto;}
.sy_popup_top_tishi{ background:#ededed; }
.sy_popup_top_tishi h3{color:#616161; font-size:16px;}
a.sy_icons_close02{
width:20px;
height:20px;
display:block;
background: url(../images/sy/sy_icons_close02.png) 0 0px no-repeat;
margin:8px 10px 0 0;
}
a:hover.sy_icons_close02{
background: url(../images/sy/sy_icons_close02.png) -40px 0px no-repeat;
}

View File

@ -62,34 +62,34 @@ a.sy_btn_green{
border-radius:3px;
}
a:hover.sy_btn_green{ background: #51a74f;}
a.sy_btn_grey{
color: #333;
background: #e1e1e1;
text-align: center;
font-size: 12px;
padding:0 15px;
height: 30px;
line-height: 30px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.sy_btn_grey{ background: #c3c3c3;}
a.sy_btn_blue{
color: #fff;
background: #3b94d6;
text-align: center;
font-size: 12px;
padding:0 15px;
height: 30px;
line-height: 30px;
-webkit-border-radius:3px;
-moz-border-radius:3px;
-o-border-radius:3px;
border-radius:3px;
}
a:hover.sy_btn_blue{ background: #2788d0;}
/*a.sy_btn_grey{*/
/*color: #333;*/
/*background: #e1e1e1;*/
/*text-align: center;*/
/*font-size: 12px;*/
/*padding:0 15px;*/
/*height: 30px;*/
/*line-height: 30px;*/
/*-webkit-border-radius:3px;*/
/*-moz-border-radius:3px;*/
/*-o-border-radius:3px;*/
/*border-radius:3px;*/
/*}*/
/*a:hover.sy_btn_grey{ background: #c3c3c3;}*/
/*a.sy_btn_blue{*/
/*color: #fff;*/
/*background: #3b94d6;*/
/*text-align: center;*/
/*font-size: 12px;*/
/*padding:0 15px;*/
/*height: 30px;*/
/*line-height: 30px;*/
/*-webkit-border-radius:3px;*/
/*-moz-border-radius:3px;*/
/*-o-border-radius:3px;*/
/*border-radius:3px;*/
/*}*/
/*a:hover.sy_btn_blue{ background: #2788d0;}*/
/* 排序 */
.sy_category{
height: 50px;